Test Failed
Pull Request — master (#86)
by Daniel
06:22 queued 03:08
created

test_lunch.LunchTest.testLunchLocations()   A

Complexity

Conditions 4

Size

Total Lines 13
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 13
rs 9.8
c 0
b 0
f 0
cc 4
nop 1
1
"""
2
Tests for the Marvin Lunch action
3
"""
4
5
from unittest import mock
6
7
from test_action import ActionTest
8
from irc2phpbb import marvin_actions
9
10
class LunchTest(ActionTest):
11
    """Tests for the Marvin Lunch action"""
12
    def testLunchLocations(self):
13
        """Test that marvin can provide lunch suggestions for certain places"""
14
        locations = ["karlskrona", "goteborg", "angelholm", "hassleholm", "malmo"]
15
        with mock.patch("irc2phpbb.marvin_actions.random") as r:
16
            for location in locations:
17
                for i, place in enumerate(self.strings.get("lunch").get("location").get(location)):
18
                    r.randint.side_effect = [0, i]
19
                    self.assertActionOutput(
20
                        marvin_actions.marvinLunch, f"mat {location}", f"Ska vi ta {place}?")
21
            r.randint.side_effect = [1, 2]
22
            self.assertActionOutput(
23
                marvin_actions.marvinLunch, "dags att luncha", "Jag är lite sugen på Indiska?")
24
        self.assertActionSilent(marvin_actions.marvinLunch, "matdags")
25