diff options
| author | 2020-08-17 20:36:48 -0700 | |
|---|---|---|
| committer | 2020-08-18 10:11:27 -0700 | |
| commit | cbdc14a3abbcbee644e9d4a6f3ffde125a7c91f1 (patch) | |
| tree | 1231dd5f6a766fe31054fea4f012f84b6b7156c6 | |
| parent | Silence tests: access everything via the silence module (diff) | |
Silence tests: remove _reschedule patch for cog tests
They don't do anything because they patch the class rather than the
instance. It's too late for patching the instance to work since the
`setUp` fixture, which instantiates the cog, executes before the patches
do. Patching `setUp` would work (and its done in the other test cases),
but some tests in this case will need the unpatched function too.
Patching it doesn't serve much benefit to most tests anyway, so it's
not worth the effort trying to make them work where they aren't needed.
| -rw-r--r-- | tests/bot/cogs/moderation/test_silence.py | 4 |
1 files changed, 0 insertions, 4 deletions
diff --git a/tests/bot/cogs/moderation/test_silence.py b/tests/bot/cogs/moderation/test_silence.py index 0a93cc623..667d61776 100644 --- a/tests/bot/cogs/moderation/test_silence.py +++ b/tests/bot/cogs/moderation/test_silence.py @@ -83,7 +83,6 @@ class SilenceCogTests(unittest.IsolatedAsyncioTestCase): self.bot = MockBot() self.cog = silence.Silence(self.bot) - @autospec(silence.Silence, "_reschedule", pass_mocks=False) @autospec(silence, "SilenceNotifier", pass_mocks=False) async def test_init_cog_got_guild(self): """Bot got guild after it became available.""" @@ -91,7 +90,6 @@ class SilenceCogTests(unittest.IsolatedAsyncioTestCase): self.bot.wait_until_guild_available.assert_awaited_once() self.bot.get_guild.assert_called_once_with(Guild.id) - @autospec(silence.Silence, "_reschedule", pass_mocks=False) @autospec(silence, "SilenceNotifier", pass_mocks=False) async def test_init_cog_got_role(self): """Got `Roles.verified` role from guild.""" @@ -99,7 +97,6 @@ class SilenceCogTests(unittest.IsolatedAsyncioTestCase): guild = self.bot.get_guild() guild.get_role.assert_called_once_with(Roles.verified) - @autospec(silence.Silence, "_reschedule", pass_mocks=False) @autospec(silence, "SilenceNotifier", pass_mocks=False) async def test_init_cog_got_channels(self): """Got channels from bot.""" @@ -107,7 +104,6 @@ class SilenceCogTests(unittest.IsolatedAsyncioTestCase): self.bot.get_channel.called_once_with(Channels.mod_alerts) self.bot.get_channel.called_once_with(Channels.mod_log) - @autospec(silence.Silence, "_reschedule", pass_mocks=False) @autospec(silence, "SilenceNotifier") async def test_init_cog_got_notifier(self, notifier): """Notifier was started with channel.""" |