| Total Complexity | 3 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | Tests for the Marvin Comic Strip action |
||
| 3 | """ |
||
| 4 | |||
| 5 | from unittest import mock |
||
| 6 | |||
| 7 | from test_action import ActionTest |
||
| 8 | from irc2phpbb import marvin_actions |
||
| 9 | |||
| 10 | class StripTest(ActionTest): |
||
| 11 | """Tests for the Marvin Comic Strip action""" |
||
| 12 | def testStrip(self): |
||
| 13 | """Test that marvin can recommend comics""" |
||
| 14 | messageFormat = self.strings.get("commitstrip").get("message") |
||
| 15 | expected = messageFormat.format(url=self.strings.get("commitstrip").get("url")) |
||
| 16 | self.assertActionOutput(marvin_actions.marvinStrip, "lite strip kanske?", expected) |
||
| 17 | self.assertActionSilent(marvin_actions.marvinStrip, "nostrip") |
||
| 18 | |||
| 19 | def testRandomStrip(self): |
||
| 20 | """Test that marvin can recommend random comics""" |
||
| 21 | messageFormat = self.strings.get("commitstrip").get("message") |
||
| 22 | expected = messageFormat.format(url=self.strings.get("commitstrip").get("urlPage") + "123") |
||
| 23 | with mock.patch("irc2phpbb.marvin_actions.random") as r: |
||
| 24 | r.randint.return_value = 123 |
||
| 25 | self.assertActionOutput(marvin_actions.marvinStrip, "random strip kanske?", expected) |
||
| 26 |