Skip to content

Commit d4ad9f1

Browse files
committed
Fix tests
1 parent be67f11 commit d4ad9f1

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

tests/test_manager.py

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,44 @@ def test_capability_admin(app, query):
134134
assert response.text == f"{u.email} is god"
135135

136136

137+
@queries(
138+
D(user="[email protected]", caps={"mafia"}, status=403),
139+
D(user="[email protected]", caps={"admin"}),
140+
)
141+
def test_manage_list(app, query):
142+
u = app.client(query.user)
143+
email = query.email or query.user
144+
response = u.get("/manage_capabilities/list", email=email, expect=query.status)
145+
if query.status is None:
146+
res = response.json()
147+
assert res["status"] == "ok"
148+
assert deserialize(dict[str, set], res["users"]) == {
149+
"[email protected]": {"villager"},
150+
"[email protected]": {"mafia"},
151+
"[email protected]": {"mafia", "baker"},
152+
"[email protected]": {"police"},
153+
"[email protected]": {"admin"},
154+
}
155+
assert deserialize(dict[str, set], res["graph"]) == {
156+
"user_management": set(),
157+
"traveller": set(),
158+
"villager": set(),
159+
"mafia": {"villager"},
160+
"police": {"villager"},
161+
"mayor": {"villager", "police"},
162+
"baker": {"villager"},
163+
"admin": {
164+
"user_management",
165+
"traveller",
166+
"villager",
167+
"mafia",
168+
"police",
169+
"mayor",
170+
"baker",
171+
},
172+
}
173+
174+
137175
@queries(
138176
# Trying to view own capabilities
139177
D(user="[email protected]", caps={"mafia"}),
@@ -145,10 +183,10 @@ def test_capability_admin(app, query):
145183
D(user="[email protected]", email="[email protected]", status=403),
146184
D(user="[email protected]", email="[email protected]", caps={"villager"}),
147185
)
148-
def test_manage_list(app, query):
186+
def test_manage_list_user(app, query):
149187
u = app.client(query.user)
150188
email = query.email or query.user
151-
response = u.get("/manage_capabilities/list", email=email, expect=query.status)
189+
response = u.get("/manage_capabilities/list_user", email=email, expect=query.status)
152190
if query.status is None:
153191
assert response.json()["email"] == email
154192
assert set(response.json()["capabilities"]) == query.caps

0 commit comments

Comments
 (0)