Test Failed
Pull Request — master (#86)
by Daniel
04:59
created

test_video.VideoOfTodayTest.testVideoOfToday()   A

Complexity

Conditions 3

Size

Total Lines 12
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 11
dl 0
loc 12
rs 9.85
c 0
b 0
f 0
cc 3
nop 1
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