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

test_video   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 17
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A VideoOfTodayTest.testVideoOfToday() 0 12 3
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