mirror of https://gitlab.com/litecord/litecord.git
tests: use test user on test_user_update
This commit is contained in:
parent
829767318e
commit
3d27a30339
|
|
@ -120,24 +120,17 @@ async def test_create_delete(test_cli_staff):
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_user_update(test_cli_staff):
|
async def test_user_update(test_cli_staff):
|
||||||
"""Test user update."""
|
"""Test user update."""
|
||||||
rjson = await _setup_user(test_cli_staff)
|
user = await test_cli_staff.create_user()
|
||||||
|
|
||||||
user_id = rjson["id"]
|
|
||||||
|
|
||||||
# test update
|
|
||||||
|
|
||||||
try:
|
|
||||||
# set them as partner flag
|
# set them as partner flag
|
||||||
resp = await test_cli_staff.patch(
|
resp = await test_cli_staff.patch(
|
||||||
f"/api/v6/admin/users/{user_id}", json={"flags": UserFlags.partner}
|
f"/api/v6/admin/users/{user.id}", json={"flags": UserFlags.partner}
|
||||||
)
|
)
|
||||||
|
|
||||||
assert resp.status_code == 200
|
assert resp.status_code == 200
|
||||||
rjson = await resp.json
|
rjson = await resp.json
|
||||||
assert rjson["id"] == user_id
|
assert rjson["id"] == str(user.id)
|
||||||
assert rjson["flags"] == UserFlags.partner
|
assert rjson["flags"] == UserFlags.partner
|
||||||
|
|
||||||
# TODO: maybe we can check for side effects by fetching the
|
refetched = await user.refetch()
|
||||||
# user manually too...
|
assert refetched.flags == UserFlags.partner
|
||||||
finally:
|
|
||||||
await _del_user(test_cli_staff, user_id)
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue