add test for webhook execution

This commit is contained in:
Luna 2021-09-16 21:57:49 -03:00
parent c79b4df252
commit 63d451f2d0
1 changed files with 16 additions and 0 deletions

View File

@ -34,3 +34,19 @@ async def test_webhook_flow(test_cli_user):
assert rjson["channel_id"] == str(channel.id)
assert rjson["guild_id"] == str(guild.id)
assert rjson["name"] == "awooga"
webhook_id = rjson["id"]
webhook_token = rjson["token"]
resp = await test_cli_user.post(
f"/api/v6/webhooks/{webhook_id}/{webhook_token}",
json={"content": "test_message"},
headers={"authorization": ""},
)
assert resp.status_code == 204
refetched_channel = await channel.refetch()
message = await test_cli_user.app.storage.get_message(
refetched_channel.last_message_id
)
assert message["author"]["id"] == webhook_id