diff options
| author | 2020-06-13 21:52:20 +0200 | |
|---|---|---|
| committer | 2020-06-13 21:52:20 +0200 | |
| commit | 39dc3cd229888acac2782237db4b9389c0788478 (patch) | |
| tree | 2e919219fc6585cfa2039e2238ce9229ad1e7e48 | |
| parent | Incidents tests: write tests for `archive` (diff) | |
Incidents tests: move `mock_404` into module namespace
This will be useful for others tests as well.
| -rw-r--r-- | tests/bot/cogs/moderation/test_incidents.py | 11 | 
1 files changed, 6 insertions, 5 deletions
| diff --git a/tests/bot/cogs/moderation/test_incidents.py b/tests/bot/cogs/moderation/test_incidents.py index 7500235cf..e51bda114 100644 --- a/tests/bot/cogs/moderation/test_incidents.py +++ b/tests/bot/cogs/moderation/test_incidents.py @@ -14,6 +14,12 @@ class MockSignal(enum.Enum):      B = "B" +mock_404 = discord.NotFound( +    response=MagicMock(aiohttp.ClientResponse),  # Mock the erroneous response +    message="Not found", +) + +  @patch("bot.constants.Channels.incidents", 123)  class TestIsIncident(unittest.TestCase):      """ @@ -165,11 +171,6 @@ class TestArchive(TestIncidents):          Implicitly, this also tests that the error is handled internally and doesn't          propagate out of the method, which is just as important.          """ -        mock_404 = discord.NotFound( -            response=MagicMock(aiohttp.ClientResponse),  # Mock the erroneous response -            message="Webhook not found", -        ) -          self.cog_instance.bot.fetch_webhook = AsyncMock(side_effect=mock_404)          self.assertFalse(await self.cog_instance.archive(incident=MockMessage(), outcome=MagicMock())) | 
