示例#1
0
def test_delete_owner():
    api_manager_mock = Mock()
    api_manager_mock.delete.return_value = 'SUCCESS'

    owner_services = OwnerServices(api_manager_mock)
    delete = owner_services.delete('owner')

    api_manager_mock.delete.assert_called_with('owners/owner')
    assert delete == 'SUCCESS'
示例#2
0
def test_claim_owner():
    api_manager_mock = Mock()
    api_manager_mock.post.return_value = 'SUCCESS'

    owner_services = OwnerServices(api_manager_mock)
    claim = owner_services.claim('owner', 'device_id')

    api_manager_mock.post.assert_called_with('owners/owner/objects/device_id/claim')
    assert claim == 'SUCCESS'
示例#3
0
def test_create_owner():
    api_manager_mock = Mock()
    api_manager_mock.post.return_value = 'SUCCESS'

    owner_services = OwnerServices(api_manager_mock)
    owner = {'username': '******', 'x_password': '******', 'x_registration_date': '2015-01-01T12:00:00'}

    create = owner_services.create(owner)
    api_manager_mock.post.assert_called_with('owners', {'username': '******', 'x_registration_date': '2015-01-01T12:00:00', 'x_password': '******'})
    assert create == 'SUCCESS'