aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-02-01 20:58:15 -0800
committerGravatar MarkKoz <[email protected]>2020-02-12 10:07:56 -0800
commit4e81281ecc87a6d2af320b3c000aea286a50f2a7 (patch)
tree77d6bccd071eeb462bcb1aeba0dc25e117c221bb /tests
parentTests: use objects for colour and permissions of MockRole (diff)
Sync tests: remove mock_role fixture
It is obsolete because MockRole now takes care of creating the Colour and Permissions objects.
Diffstat (limited to 'tests')
-rw-r--r--tests/bot/cogs/sync/test_cog.py23
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/bot/cogs/sync/test_cog.py b/tests/bot/cogs/sync/test_cog.py
index e183b429f..604daa437 100644
--- a/tests/bot/cogs/sync/test_cog.py
+++ b/tests/bot/cogs/sync/test_cog.py
@@ -1,10 +1,7 @@
import asyncio
-import typing as t
import unittest
from unittest import mock
-import discord
-
from bot import constants
from bot.api import ResponseCodeError
from bot.cogs import sync
@@ -143,28 +140,16 @@ class SyncCogListenerTests(SyncCogTestCase):
super().setUp()
self.cog.patch_user = helpers.AsyncMock(spec_set=self.cog.patch_user)
- @staticmethod
- def mock_role() -> t.Tuple[helpers.MockRole, t.Dict[str, t.Any]]:
- """Fixture to return a MockRole and corresponding JSON dict."""
- colour = 49
- permissions = 8
+ def test_sync_cog_on_guild_role_create(self):
+ """A POST request should be sent with the new role's data."""
role_data = {
- "colour": colour,
+ "colour": 49,
"id": 777,
"name": "rolename",
- "permissions": permissions,
+ "permissions": 8,
"position": 23,
}
-
role = helpers.MockRole(**role_data)
- role.colour = discord.Colour(colour)
- role.permissions = discord.Permissions(permissions)
-
- return role, role_data
-
- def test_sync_cog_on_guild_role_create(self):
- """A POST request should be sent with the new role's data."""
- role, role_data = self.mock_role()
asyncio.run(self.cog.on_guild_role_create(role))
self.bot.api_client.post.assert_called_once_with("bot/roles", json=role_data)