| Conditions | 3 |
| Total Lines | 13 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 13 | def testMorning(self): |
||
| 14 | """Test that marvin wishes good morning, at most once per day""" |
||
| 15 | marvin_general_actions.lastDateGreeted = None |
||
| 16 | with mock.patch("irc2phpbb.marvin_general_actions.datetime") as d: |
||
| 17 | d.date.today.return_value = date(2024, 5, 17) |
||
| 18 | with mock.patch("irc2phpbb.marvin_general_actions.random") as r: |
||
| 19 | r.choice.return_value = "Morgon" |
||
| 20 | self.assertActionOutput(marvin_general_actions.marvinMorning, "morrn", "Morgon") |
||
| 21 | # Should only greet once per day |
||
| 22 | self.assertActionSilent(marvin_general_actions.marvinMorning, "morgon") |
||
| 23 | # Should greet again tomorrow |
||
| 24 | d.date.today.return_value = date(2024, 5, 18) |
||
| 25 | self.assertActionOutput(marvin_general_actions.marvinMorning, "godmorgon", "Morgon") |
||
| 26 |