| Total Complexity | 5 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | Tests for the Marvin Hello action |
||
| 3 | """ |
||
| 4 | |||
| 5 | from unittest import mock |
||
| 6 | |||
| 7 | from test_action import ActionTest |
||
| 8 | from irc2phpbb import marvin_actions |
||
| 9 | |||
| 10 | class HelloTest(ActionTest): |
||
| 11 | """Tests for the Marvin Hello action""" |
||
| 12 | def testSayHello(self): |
||
| 13 | """Test that marvin responds to greetings""" |
||
| 14 | with mock.patch("irc2phpbb.marvin_actions.random") as r: |
||
| 15 | for skey, s in enumerate(self.strings.get("smile")): |
||
| 16 | for hkey, h in enumerate(self.strings.get("hello")): |
||
| 17 | for fkey, f in enumerate(self.strings.get("friendly")): |
||
| 18 | r.randint.side_effect = [skey, hkey, fkey] |
||
| 19 | self.assertActionOutput(marvin_actions.marvinSayHi, "hej", f"{s} {h} {f}") |
||
| 20 | self.assertActionSilent(marvin_actions.marvinSayHi, "korsning") |
||
| 21 |