update tests

This commit is contained in:
vpopescu
2022-08-04 16:16:39 +02:00
2 changed files with 9 additions and 45 deletions

View File

@@ -1694,20 +1694,8 @@ async def test_groups_list(app):
r.raise_for_status() r.raise_for_status()
reply = r.json() reply = r.json()
assert reply == [ assert reply == [
{ {'kind': 'group', 'name': 'alphaflight', 'users': [], 'roles': [], 'properties':{}},
'kind': 'group', {'kind': 'group', 'name': 'betaflight', 'users': [], 'roles': [], 'properties':{}},
'name': 'alphaflight',
'users': [],
'roles': [],
'properties': {},
},
{
'kind': 'group',
'name': 'betaflight',
'users': [],
'roles': [],
'properties': {},
},
] ]
# Test offset for pagination # Test offset for pagination
@@ -1715,15 +1703,7 @@ async def test_groups_list(app):
r.raise_for_status() r.raise_for_status()
reply = r.json() reply = r.json()
assert r.status_code == 200 assert r.status_code == 200
assert reply == [ assert reply == [{'kind': 'group', 'name': 'betaflight', 'users': [], 'roles': [],'properties':{}}]
{
'kind': 'group',
'name': 'betaflight',
'users': [],
'roles': [],
'properties': {},
}
]
r = await api_request(app, "groups?offset=10") r = await api_request(app, "groups?offset=10")
r.raise_for_status() r.raise_for_status()
@@ -1735,29 +1715,13 @@ async def test_groups_list(app):
r.raise_for_status() r.raise_for_status()
reply = r.json() reply = r.json()
assert r.status_code == 200 assert r.status_code == 200
assert reply == [ assert reply == [{'kind': 'group', 'name': 'alphaflight', 'users': [], 'roles': [],'properties':{}}]
{
'kind': 'group',
'name': 'alphaflight',
'users': [],
'roles': [],
'properties': {},
}
]
# 0 is rounded up to 1 # 0 is rounded up to 1
r = await api_request(app, "groups?limit=0") r = await api_request(app, "groups?limit=0")
r.raise_for_status() r.raise_for_status()
reply = r.json() reply = r.json()
assert reply == [ assert reply == [{'kind': 'group', 'name': 'alphaflight', 'users': [], 'roles': [],'properties':{}}]
{
'kind': 'group',
'name': 'alphaflight',
'users': [],
'roles': [],
'properties': {},
}
]
@mark.group @mark.group
@@ -1800,7 +1764,7 @@ async def test_group_get(app):
'name': 'alphaflight', 'name': 'alphaflight',
'users': ['sasquatch'], 'users': ['sasquatch'],
'roles': [], 'roles': [],
'properties': {}, 'properties':{},
} }

View File

@@ -568,9 +568,9 @@ async def test_load_roles_services(tmpdir, request, preserve_scopes):
async def test_load_roles_groups(tmpdir, request): async def test_load_roles_groups(tmpdir, request):
"""Test loading predefined roles for groups in app.py""" """Test loading predefined roles for groups in app.py"""
groups_to_load = { groups_to_load = {
'group1': ['gandalf'], 'group1':{'users': ['gandalf'], 'properties': {}},
'group2': ['bilbo', 'gargamel'], 'group2':{'users':['bilbo', 'gargamel'], 'properties': {}},
'group3': ['cyclops'], 'group3':{'users': ['cyclops'], 'properties': {}},
} }
roles_to_load = [ roles_to_load = [
{ {