Exemple #1
0
def test_delete_object():
    api_manager_mock = Mock()
    api_manager_mock.delete.return_value = 'SUCCESS'

    object_services = ObjectServices(api_manager_mock)
    delete = object_services.delete('object')

    api_manager_mock.delete.assert_called_with('objects/object')
    assert delete == 'SUCCESS'
Exemple #2
0
def test_update_object():
    api_manager_mock = Mock()
    api_manager_mock.put.return_value = 'SUCCESS'

    object_services = ObjectServices(api_manager_mock)
    smart_object = {'x_device_id': 'DEVICE_ID', 'x_object_type': 'OBJECT_TYPE', 'x_registration_date': '2015-01-01T12:00:00'}
    update = object_services.update(smart_object)

    api_manager_mock.put.assert_called_with('objects/DEVICE_ID', {'x_device_id': 'DEVICE_ID', 'x_object_type': 'OBJECT_TYPE', 'x_registration_date': '2015-01-01T12:00:00'})
    assert update == 'SUCCESS'