# Path: cozify/cloud_api.py
# def get(call, headers=None, base=cloudBase, no_headers=False, json_output=True, raw=False,
#         **kwargs):
# def post(call,
#          headers=None,
#          data=None,
#          params=None,
#          base=cloudBase,
#          no_headers=False,
#          raw=False,
#          **kwargs):
# def put(call, headers=None, data=None, base=cloudBase, no_headers=False, raw=False, **kwargs):
# def requestlogin(email, **kwargs):  # pragma: no cover
# def emaillogin(email, otp, **kwargs):
# def lan_ip(**kwargs):
# def hubkeys(cloud_token, **kwargs):  # pragma: no cover
# def refreshsession(cloud_token, **kwargs):  # pragma: no cover
# def remote(apicall, headers, data=None):
# def _call(*,
#           call,
#           method,
#           headers,
#           params=None,
#           data=None,
#           no_headers=False,
#           json_output=True,
#           raw=False,
#           **kwargs):
# 
# Path: cozify/test/debug.py

# 
# Path: cozify/Error.py
# class AuthenticationError(Exception):
#     """Error raised for nonrecoverable authentication failures.
# 
#     Args:
#         message(str): Human readable error description
#     
#     Attributes:
#         message(str): Human readable error description
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Authentication error: {}'.format(self.message)
# 
# class APIError(Exception):
#     """Error raised for non-200 API return codes
# 
#     Args:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     
#     Attributes:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     """
# 
#     def __init__(self, status_code, message):
#         self.status_code = status_code
#         self.message = message
# 
#     def __str__(self):
#         return 'API error, {code}: {message}'.format(code=self.status_code, message=self.message)
# 
# class ConnectionError(ConnectionError):
#     """Error raised for connection level failures,
#     such as a lost internet connection.
# 
#     Args:
#         message(str): Potential error message returned by the requests library
# 
#     Attributes:
#         message(str): Potential error message returned by the requests library
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Connection error: {}'.format(self.message)


import os, pytest, tempfile, datetime
from cozify import cloud_api
from cozify.test import debug
from cozify.test.fixtures import *
from cozify.Error import AuthenticationError, APIError, ConnectionError
from mbtest.imposters import Imposter, Predicate, Stub, Response
#!/usr/bin/env python3





@pytest.mark.mbtest
def test_cloud_api_mock_lan_ip(mock_server):
    imposter = Imposter(Stub(Predicate(path="/hub/lan_ip"), Response(body='[ "127.0.0.1" ]')))
    with mock_server(imposter):

# Path: cozify/cloud_api.py
# def get(call, headers=None, base=cloudBase, no_headers=False, json_output=True, raw=False,
#         **kwargs):
# def post(call,
#          headers=None,
#          data=None,
#          params=None,
#          base=cloudBase,
#          no_headers=False,
#          raw=False,
#          **kwargs):
# def put(call, headers=None, data=None, base=cloudBase, no_headers=False, raw=False, **kwargs):
# def requestlogin(email, **kwargs):  # pragma: no cover
# def emaillogin(email, otp, **kwargs):
# def lan_ip(**kwargs):
# def hubkeys(cloud_token, **kwargs):  # pragma: no cover
# def refreshsession(cloud_token, **kwargs):  # pragma: no cover
# def remote(apicall, headers, data=None):
# def _call(*,
#           call,
#           method,
#           headers,
#           params=None,
#           data=None,
#           no_headers=False,
#           json_output=True,
#           raw=False,
#           **kwargs):
# 
# Path: cozify/test/debug.py

# 
# Path: cozify/Error.py
# class AuthenticationError(Exception):
#     """Error raised for nonrecoverable authentication failures.
# 
#     Args:
#         message(str): Human readable error description
#     
#     Attributes:
#         message(str): Human readable error description
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Authentication error: {}'.format(self.message)
# 
# class APIError(Exception):
#     """Error raised for non-200 API return codes
# 
#     Args:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     
#     Attributes:
#         status_code(int): HTTP status code returned by the API
#         message(str): Potential error message returned by the API
#     """
# 
#     def __init__(self, status_code, message):
#         self.status_code = status_code
#         self.message = message
# 
#     def __str__(self):
#         return 'API error, {code}: {message}'.format(code=self.status_code, message=self.message)
# 
# class ConnectionError(ConnectionError):
#     """Error raised for connection level failures,
#     such as a lost internet connection.
# 
#     Args:
#         message(str): Potential error message returned by the requests library
# 
#     Attributes:
#         message(str): Potential error message returned by the requests library
#     """
# 
#     def __init__(self, message):
#         self.message = message
# 
#     def __str__(self):
#         return 'Connection error: {}'.format(self.message)


# Path: cozify/test/test_cloud_api.py
import os, pytest, tempfile, datetime
from cozify import cloud_api
from cozify.test import debug
from cozify.test.fixtures import *
from cozify.Error import AuthenticationError, APIError, ConnectionError
from mbtest.imposters import Imposter, Predicate, Stub, Response

#!/usr/bin/env python3





@pytest.mark.mbtest
def test_cloud_api_mock_lan_ip(mock_server):
    imposter = Imposter(Stub(Predicate(path="/hub/lan_ip"), Response(body='[ "127.0.0.1" ]')))
    with mock_server(imposter):

        assert cloud_api.lan_ip(base=imposter.url)