Passed
Push — main ( 95bc96...0b198e )
by Jochen
04:40
created

permission()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
"""
2
:Copyright: 2006-2021 Jochen Kupperschmidt
3
:License: Revised BSD (see `LICENSE` file for details)
4
"""
5
6
import pytest
7
8
import byceps.services.authorization.service as authz_service
9
10
from tests.helpers import login_user
11
12
13
@pytest.fixture(scope='package')
14
def role_admin(make_admin):
15
    permission_ids = {
16
        'admin.access',
17
        'role.assign',
18
        'role.view',
19
    }
20
    admin = make_admin('RoleAdmin', permission_ids)
21
    login_user(admin.id)
22
    return admin
23
24
25
@pytest.fixture(scope='package')
26
def role_admin_client(make_client, admin_app, role_admin):
27
    return make_client(admin_app, user_id=role_admin.id)
28
29
30
@pytest.fixture(scope='module')
31
def role():
32
    role_id = 'spin_doctor'
33
    title = 'Dr. Spin'
34
35
    role = authz_service.create_role(role_id, title)
36
37
    yield role
38
39
    authz_service.delete_role(role.id)
40