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

test_quote   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 16
dl 0
loc 24
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A QuoteTest.testQuote() 0 12 3
1
"""
2
Tests for the Marvin Quote action
3
"""
4
5
from unittest import mock
6
7
from test_action import ActionTest
8
from irc2phpbb import marvin_actions
9
10
class QuoteTest(ActionTest):
11
    """Tests for the Marvin Quote action"""
12
    def testQuote(self):
13
        """Test that marvin can quote The Hitchhikers Guide to the Galaxy"""
14
        with mock.patch("irc2phpbb.marvin_actions.random") as r:
15
            r.randint.return_value = 1
16
            self.assertStringsOutput(marvin_actions.marvinQuote, "ge os ett citat", "hitchhiker", 1)
17
            self.assertStringsOutput(marvin_actions.marvinQuote, "filosofi", "hitchhiker", 1)
18
            self.assertStringsOutput(marvin_actions.marvinQuote, "filosofera", "hitchhiker", 1)
19
            self.assertActionSilent(marvin_actions.marvinQuote, "noquote")
20
21
            for i,_ in enumerate(self.strings.get("hitchhiker")):
22
                r.randint.return_value = i
23
                self.assertStringsOutput(marvin_actions.marvinQuote, "quote", "hitchhiker", i)
24