コード例 #1
0
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())
コード例 #2
0
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))
コード例 #3
0
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']))
コード例 #4
0
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)
コード例 #5
0
def test_put_errors(call_permission):
    url = confd.callpermissions(call_permission['id']).put
    for check in error_checks(url):
        yield check
コード例 #6
0
def test_get_errors():
    fake_get = confd.callpermissions(999999).get
    yield s.check_resource_not_found, fake_get, 'CallPermission'
コード例 #7
0
def test_delete_call_permission(call_permission):
    response = confd.callpermissions(call_permission['id']).delete()
    response.assert_deleted()
コード例 #8
0
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'))
コード例 #9
0
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'
コード例 #10
0
def delete_call_permission(call_permission_id, check=False):
    response = confd.callpermissions(call_permission_id).delete()
    if check:
        response.assert_ok()