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

test_hello   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 14
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A HelloTest.testSayHello() 0 9 5
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