def test_delete_call_permission_when_user_and_call_permission_associated( user, call_permission): with a.user_call_permission(user, call_permission, check=False): response = confd.users(user['id']).callpermissions.get() assert_that(response.items, not_(empty())) confd.callpermissions(call_permission['id']).delete().assert_deleted() response = confd.users(user['id']).callpermissions.get() assert_that(response.items, empty())
def test_edit_call_permission_all_parameters(call_permission): parameters = {'name': 'second', 'password': '******', 'description': 'Create description', 'mode': 'allow', 'enabled': False, 'extensions': ['123', '*456', '963']} response = confd.callpermissions(call_permission['id']).put(**parameters) response.assert_updated() response = confd.callpermissions(call_permission['id']).get() assert_that(response.item, has_entries(parameters))
def test_get(call_permission): response = confd.callpermissions(call_permission['id']).get() assert_that(response.item, has_entries(name='search', password='******', description='SearchDesc', mode='deny', enabled=True, extensions=['123', '456']))
def test_get_users_associated_to_call_permission(user1, user2, call_permission): expected = contains( has_entries({ 'user_id': user1['id'], 'call_permission_id': call_permission['id'] }), has_entries({ 'user_id': user2['id'], 'call_permission_id': call_permission['id'] })) with a.user_call_permission(user1, call_permission): with a.user_call_permission(user2, call_permission): response = confd.callpermissions(call_permission['id']).users.get() assert_that(response.items, expected)
def test_put_errors(call_permission): url = confd.callpermissions(call_permission['id']).put for check in error_checks(url): yield check
def test_get_errors(): fake_get = confd.callpermissions(999999).get yield s.check_resource_not_found, fake_get, 'CallPermission'
def test_delete_call_permission(call_permission): response = confd.callpermissions(call_permission['id']).delete() response.assert_deleted()
def test_edit_call_permission_with_same_name(first_call_permission, second_call_permission): response = confd.callpermissions(first_call_permission['id']).put(name=second_call_permission['name']) response.assert_match(400, e.resource_exists('CallPermission'))
def test_get_errors(): fake_user = confd.users(FAKE_ID).callpermissions.get fake_call_permission = confd.callpermissions(FAKE_ID).users.get yield s.check_resource_not_found, fake_user, 'User' yield s.check_resource_not_found, fake_call_permission, 'CallPermission'
def delete_call_permission(call_permission_id, check=False): response = confd.callpermissions(call_permission_id).delete() if check: response.assert_ok()