Code Duplication    Length = 23-23 lines in 2 locations

tests/unit/commands/test_users_parser.py 1 location

@@ 9-31 (lines=23) @@
6
from kytos.cli.commands.users.parser import call, parse
7
8
9
class TestUsersParser(unittest.TestCase):
10
    """Test the UsersAPI parser methods."""
11
12
    @staticmethod
13
    @patch('kytos.cli.commands.users.parser.call')
14
    @patch('kytos.cli.commands.users.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.users.api.UsersAPI.register')
25
    @patch('kytos.utils.config.KytosConfig')
26
    def test_call(*args):
27
        """Test call method."""
28
        (_, mock_users_api) = args
29
        call('register', 'args')
30
31
        mock_users_api.assert_called_with('args')
32

tests/unit/commands/test_web_parser.py 1 location

@@ 9-31 (lines=23) @@
6
from kytos.cli.commands.web.parser import call, parse
7
8
9
class TestWebParser(unittest.TestCase):
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