# 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 ApiResponseError
# Copyright (C) 2018 DataArt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================




def test_save(test):
    device_hive_api = test.device_hive_api()
    device_id = test.generate_id('c-s', test.DEVICE_ENTITY)
    command_name = test.generate_id('c-s')
    device = device_hive_api.put_device(device_id)
    command = device.send_command(command_name)
    status = 'status'
    result = {'result_key': 'result_value'}

# 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_command.py
from devicehive import ApiResponseError

# Copyright (C) 2018 DataArt
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# =============================================================================




def test_save(test):
    device_hive_api = test.device_hive_api()
    device_id = test.generate_id('c-s', test.DEVICE_ENTITY)
    command_name = test.generate_id('c-s')
    device = device_hive_api.put_device(device_id)
    command = device.send_command(command_name)
    status = 'status'
    result = {'result_key': 'result_value'}

    command.status = status