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

test_hello.HelloTest.testSayHello()   A

Complexity

Conditions 5

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 9
rs 9.3333
c 0
b 0
f 0
cc 5
nop 1
1
"""
2
Tests for the Marvin Hello action
3
"""
4
5
from unittest import mock
6
7
from test_action import ActionTest
8
from irc2phpbb import marvin_actions
9
10
class HelloTest(ActionTest):
11
    """Tests for the Marvin Hello action"""
12
    def testSayHello(self):
13
        """Test that marvin responds to greetings"""
14
        with mock.patch("irc2phpbb.marvin_actions.random") as r:
15
            for skey, s in enumerate(self.strings.get("smile")):
16
                for hkey, h in enumerate(self.strings.get("hello")):
17
                    for fkey, f in enumerate(self.strings.get("friendly")):
18
                        r.randint.side_effect = [skey, hkey, fkey]
19
                        self.assertActionOutput(marvin_actions.marvinSayHi, "hej", f"{s} {h} {f}")
20
        self.assertActionSilent(marvin_actions.marvinSayHi, "korsning")
21