add test for guild nickname setting

This commit is contained in:
Luna 2022-08-13 23:14:32 -03:00
parent 2e346eb350
commit 1d4f99f375
1 changed files with 24 additions and 0 deletions

View File

@ -78,3 +78,27 @@ async def test_guild_create(test_cli_user):
resp = await test_cli_user.delete(f"/api/v6/guilds/{guild_id}") resp = await test_cli_user.delete(f"/api/v6/guilds/{guild_id}")
assert resp.status_code == 204 assert resp.status_code == 204
@pytest.mark.asyncio
async def test_guild_nickname(test_cli_user):
guild = await test_cli_user.create_guild()
NEW_NICKNAME = "my awesome nickname"
# stage 1: create
resp = await test_cli_user.patch(
f"/api/v6/guilds/{guild.id}/members/@me/nick",
json={"nick": NEW_NICKNAME},
)
assert resp.status_code == 200
assert (await resp.data).decode() == NEW_NICKNAME
# stage 2: test
resp = await test_cli_user.get(f"/api/v6/guilds/{guild.id}")
assert resp.status_code == 200
fetched_guild = await resp.json
assert fetched_guild["id"] == str(guild.id)
assert fetched_guild["members"][0]["nick"] == NEW_NICKNAME