# Path: devicehive/device.py
# class DeviceError(ApiRequestError):
#     """Device error."""
# 
# Path: devicehive/subscription.py
# class SubscriptionError(ApiRequestError):
#     """Subscription error."""
# 
# Path: devicehive/api_response.py
# class ApiResponseError(TransportError):
#     """Api response error."""
# 
#     def __init__(self, message, transport_name, code, error):
#         message = '%s Transport: %s. Code: %s. Error: %s' % (message,
#                                                              transport_name,
#                                                              code, error)
#         super(ApiResponseError, self).__init__(message)
#         self._transport_name = transport_name
#         self._code = code
#         self._error = error
# 
#     @property
#     def transport_name(self):
#         return self._transport_name
# 
#     @property
#     def code(self):
#         return self._code
# 
#     @property
#     def error(self):
#         return self._error


from devicehive import DeviceError, SubscriptionError
from devicehive import ApiResponseError
                'status': '1'},
               {'command': '%s-name-2' % test_id, 'lifetime': 100,
                'status': '2'}]
    device = device_hive_api.put_device(test_id)
    for option in options:
        device.send_command(option['command'], lifetime=option['lifetime'],
                            status=option['status'])
    commands = device.list_commands()
    assert len(commands) == len(options)
    commands = device.list_commands(start=server_timestamp)
    assert len(commands) == len(options)
    assert not device.list_commands(start=server_timestamp,
                                    end=server_timestamp)
    command_name = options[0]['command']
    command, = device.list_commands(command=command_name)
    assert command.command == command_name
    status = options[0]['status']
    command, = device.list_commands(status=status)
    assert command.status == status
    command_0, command_1 = device.list_commands(sort_field='command',
                                                sort_order='ASC')
    assert command_0.command == options[0]['command']
    assert command_1.command == options[1]['command']
    command_0, command_1 = device.list_commands(sort_field='command',
                                                sort_order='DESC')
    assert command_0.command == options[1]['command']
    assert command_1.command == options[0]['command']
    command, = device.list_commands(sort_field='command', sort_order='ASC',
                                    take=1)
    assert command.command == options[0]['command']

# Path: devicehive/device.py
# class DeviceError(ApiRequestError):
#     """Device error."""
# 
# Path: devicehive/subscription.py
# class SubscriptionError(ApiRequestError):
#     """Subscription error."""
# 
# Path: devicehive/api_response.py
# class ApiResponseError(TransportError):
#     """Api response error."""
# 
#     def __init__(self, message, transport_name, code, error):
#         message = '%s Transport: %s. Code: %s. Error: %s' % (message,
#                                                              transport_name,
#                                                              code, error)
#         super(ApiResponseError, self).__init__(message)
#         self._transport_name = transport_name
#         self._code = code
#         self._error = error
# 
#     @property
#     def transport_name(self):
#         return self._transport_name
# 
#     @property
#     def code(self):
#         return self._code
# 
#     @property
#     def error(self):
#         return self._error


# Path: tests/test_api_device.py
from devicehive import DeviceError, SubscriptionError
from devicehive import ApiResponseError

                'status': '1'},
               {'command': '%s-name-2' % test_id, 'lifetime': 100,
                'status': '2'}]
    device = device_hive_api.put_device(test_id)
    for option in options:
        device.send_command(option['command'], lifetime=option['lifetime'],
                            status=option['status'])
    commands = device.list_commands()
    assert len(commands) == len(options)
    commands = device.list_commands(start=server_timestamp)
    assert len(commands) == len(options)
    assert not device.list_commands(start=server_timestamp,
                                    end=server_timestamp)
    command_name = options[0]['command']
    command, = device.list_commands(command=command_name)
    assert command.command == command_name
    status = options[0]['status']
    command, = device.list_commands(status=status)
    assert command.status == status
    command_0, command_1 = device.list_commands(sort_field='command',
                                                sort_order='ASC')
    assert command_0.command == options[0]['command']
    assert command_1.command == options[1]['command']
    command_0, command_1 = device.list_commands(sort_field='command',
                                                sort_order='DESC')
    assert command_0.command == options[1]['command']
    assert command_1.command == options[0]['command']
    command, = device.list_commands(sort_field='command', sort_order='ASC',
                                    take=1)
    assert command.command == options[0]['command']

    command, = device.list_commands(sort_field='command', sort_order='ASC',