diff options
| author | 2020-08-12 22:31:08 -0700 | |
|---|---|---|
| committer | 2020-08-14 09:43:39 -0700 | |
| commit | 470ca200680473fe671f9a2c2afa5e715ba95ad7 (patch) | |
| tree | 0374ba27cdbe7082125c7935e46d63c3ef71bc72 /tests | |
| parent | Restructure tests and fix broken tests (diff) | |
Prefix names of non-extension modules with _
This naming scheme will make them easy to distinguish from extensions.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/bot/cogs/backend/sync/test_base.py | 2 | ||||
| -rw-r--r-- | tests/bot/cogs/backend/sync/test_cog.py | 15 | ||||
| -rw-r--r-- | tests/bot/cogs/backend/sync/test_roles.py | 2 | ||||
| -rw-r--r-- | tests/bot/cogs/backend/sync/test_users.py | 2 | ||||
| -rw-r--r-- | tests/bot/cogs/moderation/infraction/test_infractions.py | 6 | 
5 files changed, 14 insertions, 13 deletions
diff --git a/tests/bot/cogs/backend/sync/test_base.py b/tests/bot/cogs/backend/sync/test_base.py index 0d0a8299d..3009aacb6 100644 --- a/tests/bot/cogs/backend/sync/test_base.py +++ b/tests/bot/cogs/backend/sync/test_base.py @@ -6,7 +6,7 @@ import discord  from bot import constants  from bot.api import ResponseCodeError -from bot.cogs.backend.sync.syncers import Syncer, _Diff +from bot.cogs.backend.sync._syncers import Syncer, _Diff  from tests import helpers diff --git a/tests/bot/cogs/backend/sync/test_cog.py b/tests/bot/cogs/backend/sync/test_cog.py index 199747051..e40552817 100644 --- a/tests/bot/cogs/backend/sync/test_cog.py +++ b/tests/bot/cogs/backend/sync/test_cog.py @@ -6,7 +6,8 @@ import discord  from bot import constants  from bot.api import ResponseCodeError  from bot.cogs.backend import sync -from bot.cogs.backend.sync.syncers import Syncer +from bot.cogs.backend.sync._cog import Sync +from bot.cogs.backend.sync._syncers import Syncer  from tests import helpers  from tests.base import CommandTestCase @@ -29,19 +30,19 @@ class SyncCogTestCase(unittest.IsolatedAsyncioTestCase):          self.bot = helpers.MockBot()          self.role_syncer_patcher = mock.patch( -            "bot.cogs.backend.sync.syncers.RoleSyncer", +            "bot.cogs.backend.sync._syncers.RoleSyncer",              autospec=Syncer,              spec_set=True          )          self.user_syncer_patcher = mock.patch( -            "bot.cogs.backend.sync.syncers.UserSyncer", +            "bot.cogs.backend.sync._syncers.UserSyncer",              autospec=Syncer,              spec_set=True          )          self.RoleSyncer = self.role_syncer_patcher.start()          self.UserSyncer = self.user_syncer_patcher.start() -        self.cog = sync.Sync(self.bot) +        self.cog = Sync(self.bot)      def tearDown(self):          self.role_syncer_patcher.stop() @@ -59,7 +60,7 @@ class SyncCogTestCase(unittest.IsolatedAsyncioTestCase):  class SyncCogTests(SyncCogTestCase):      """Tests for the Sync cog.""" -    @mock.patch.object(sync.Sync, "sync_guild", new_callable=mock.MagicMock) +    @mock.patch.object(Sync, "sync_guild", new_callable=mock.MagicMock)      def test_sync_cog_init(self, sync_guild):          """Should instantiate syncers and run a sync for the guild."""          # Reset because a Sync cog was already instantiated in setUp. @@ -70,7 +71,7 @@ class SyncCogTests(SyncCogTestCase):          mock_sync_guild_coro = mock.MagicMock()          sync_guild.return_value = mock_sync_guild_coro -        sync.Sync(self.bot) +        Sync(self.bot)          self.RoleSyncer.assert_called_once_with(self.bot)          self.UserSyncer.assert_called_once_with(self.bot) @@ -131,7 +132,7 @@ class SyncCogListenerTests(SyncCogTestCase):          super().setUp()          self.cog.patch_user = mock.AsyncMock(spec_set=self.cog.patch_user) -        self.guild_id_patcher = mock.patch("bot.cogs.backend.sync.cog.constants.Guild.id", 5) +        self.guild_id_patcher = mock.patch("bot.cogs.backend.sync._cog.constants.Guild.id", 5)          self.guild_id = self.guild_id_patcher.start()          self.guild = helpers.MockGuild(id=self.guild_id) diff --git a/tests/bot/cogs/backend/sync/test_roles.py b/tests/bot/cogs/backend/sync/test_roles.py index cc2e51c7f..99d682ede 100644 --- a/tests/bot/cogs/backend/sync/test_roles.py +++ b/tests/bot/cogs/backend/sync/test_roles.py @@ -3,7 +3,7 @@ from unittest import mock  import discord -from bot.cogs.backend.sync.syncers import RoleSyncer, _Diff, _Role +from bot.cogs.backend.sync._syncers import RoleSyncer, _Diff, _Role  from tests import helpers diff --git a/tests/bot/cogs/backend/sync/test_users.py b/tests/bot/cogs/backend/sync/test_users.py index 490ea9e06..51dcbe48a 100644 --- a/tests/bot/cogs/backend/sync/test_users.py +++ b/tests/bot/cogs/backend/sync/test_users.py @@ -1,7 +1,7 @@  import unittest  from unittest import mock -from bot.cogs.backend.sync.syncers import UserSyncer, _Diff, _User +from bot.cogs.backend.sync._syncers import UserSyncer, _Diff, _User  from tests import helpers diff --git a/tests/bot/cogs/moderation/infraction/test_infractions.py b/tests/bot/cogs/moderation/infraction/test_infractions.py index a79042557..2df61d431 100644 --- a/tests/bot/cogs/moderation/infraction/test_infractions.py +++ b/tests/bot/cogs/moderation/infraction/test_infractions.py @@ -17,8 +17,8 @@ class TruncationTests(unittest.IsolatedAsyncioTestCase):          self.guild = MockGuild(id=4567)          self.ctx = MockContext(bot=self.bot, author=self.user, guild=self.guild) -    @patch("bot.cogs.moderation.infraction.utils.get_active_infraction") -    @patch("bot.cogs.moderation.infraction.utils.post_infraction") +    @patch("bot.cogs.moderation.infraction._utils.get_active_infraction") +    @patch("bot.cogs.moderation.infraction._utils.post_infraction")      async def test_apply_ban_reason_truncation(self, post_infraction_mock, get_active_mock):          """Should truncate reason for `ctx.guild.ban`."""          get_active_mock.return_value = None @@ -39,7 +39,7 @@ class TruncationTests(unittest.IsolatedAsyncioTestCase):              self.ctx, {"foo": "bar"}, self.target, self.ctx.guild.ban.return_value          ) -    @patch("bot.cogs.moderation.infraction.utils.post_infraction") +    @patch("bot.cogs.moderation.infraction._utils.post_infraction")      async def test_apply_kick_reason_truncation(self, post_infraction_mock):          """Should truncate reason for `Member.kick`."""          post_infraction_mock.return_value = {"foo": "bar"}  |