| Total Complexity | 3 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """ |
||
| 2 | Tests for the Marvin Video of the Day action |
||
| 3 | """ |
||
| 4 | |||
| 5 | from datetime import date, timedelta |
||
| 6 | from unittest import mock |
||
| 7 | |||
| 8 | from test_action import ActionTest |
||
| 9 | from irc2phpbb import marvin_actions |
||
| 10 | |||
| 11 | class VideoOfTodayTest(ActionTest): |
||
| 12 | """Tests for the Marvin Video of the Day action""" |
||
| 13 | def testVideoOfToday(self): |
||
| 14 | """Test that marvin can link to a different video each day of the week""" |
||
| 15 | with mock.patch("irc2phpbb.marvin_actions.datetime") as dt: |
||
| 16 | for d in range(1, 8): |
||
| 17 | day = date(2024, 11, 25) + timedelta(days=d) |
||
| 18 | dt.date.today.return_value = day |
||
| 19 | weekday = day.strftime("%A") |
||
| 20 | weekdayPhrase = self.strings.get("video-of-today").get(weekday).get("message") |
||
| 21 | videoPhrase = self.strings.get("video-of-today").get(weekday).get("url") |
||
| 22 | response = f"{weekdayPhrase} En passande video är {videoPhrase}" |
||
| 23 | self.assertActionOutput(marvin_actions.marvinVideoOfToday, "dagens video", response) |
||
| 24 | self.assertActionSilent(marvin_actions.marvinVideoOfToday, "videoidag") |
||
| 25 |