|
3 | 3 | from . import SCHEMA_PREFIX, client, token, group1_token, connection, schemas_simple |
4 | 4 |
|
5 | 5 |
|
6 | | -def test_dependencies_underprivileged(group1_token, client, schemas_simple): |
7 | | - schema_name = f'{SCHEMA_PREFIX}group1_simple' |
8 | | - table_name = 'TableA' |
9 | | - restriction = b64encode(dumps(dict(a_id=0)).encode('utf-8')).decode('utf-8') |
10 | | - REST_dependencies = client.get( |
11 | | - f"""/record/dependency?schemaName={ |
12 | | - schema_name}&tableName={table_name}&restriction={restriction}""", |
13 | | - headers=dict(Authorization=f'Bearer {group1_token}')).json['dependencies'] |
14 | | - REST_records = client.post('/fetch_tuples', |
15 | | - headers=dict(Authorization=f'Bearer {group1_token}'), |
16 | | - json=dict(schemaName=schema_name, |
17 | | - tableName=table_name)).json['tuples'] |
18 | | - assert len(REST_records) == 2 |
19 | | - assert len(REST_dependencies) == 4 |
20 | | - table_a = [el for el in REST_dependencies |
21 | | - if (el['schema'] == f'{SCHEMA_PREFIX}group1_simple' and |
22 | | - 'table_a' in el['table'])][0] |
23 | | - assert table_a['accessible'] and table_a['count'] == 1 |
24 | | - table_b = [el for el in REST_dependencies |
25 | | - if (el['schema'] == f'{SCHEMA_PREFIX}group1_simple' and |
26 | | - 'table_b' in el['table'])][0] |
27 | | - assert table_b['accessible'] and table_b['count'] == 2 |
28 | | - table_c = [el for el in REST_dependencies |
29 | | - if (el['schema'] == f'{SCHEMA_PREFIX}group1_simple' and |
30 | | - 'table_c' in el['table'])][0] |
31 | | - assert table_c['accessible'] and table_c['count'] == 3 |
32 | | - diff_table_b = [el for el in REST_dependencies |
33 | | - if (el['schema'] == f'{SCHEMA_PREFIX}group2_simple' and |
34 | | - 'diff_table_b' in el['table'])][0] |
35 | | - assert not diff_table_b['accessible'] |
36 | | - |
37 | | - |
38 | 6 | def test_dependencies_admin(token, client, schemas_simple): |
39 | 7 | schema_name = f'{SCHEMA_PREFIX}group1_simple' |
40 | 8 | table_name = 'TableA' |
|
0 commit comments