Completed
Pull Request — master (#277)
by Gleyberson
01:29
created

TestWebParser.test_call()   A

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 7

Duplication

Lines 9
Ratio 100 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nop 1
dl 9
loc 9
rs 10
c 0
b 0
f 0
1
"""kytos.cli.commands.web.parser tests."""
2
import sys
3
import unittest
4
from unittest.mock import patch
5
6
from kytos.cli.commands.web.parser import call, parse
7
8
9 View Code Duplication
class TestWebParser(unittest.TestCase):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
10
    """Test the WebAPI parser methods."""
11
12
    @staticmethod
13
    @patch('kytos.cli.commands.web.parser.call')
14
    @patch('kytos.cli.commands.web.parser.docopt', return_value='args')
15
    def test_parse(*args):
16
        """Test parse method."""
17
        (_, mock_call) = args
18
        with patch.object(sys, 'argv', ['A', 'B', 'C']):
19
            parse('argv')
20
21
            mock_call.assert_called_with('C', 'args')
22
23
    @staticmethod
24
    @patch('kytos.cli.commands.web.api.WebAPI.update')
25
    @patch('kytos.utils.config.KytosConfig')
26
    def test_call(*args):
27
        """Test call method."""
28
        (_, mock_web_api) = args
29
        call('update', 'args')
30
31
        mock_web_api.assert_called_with('args')
32