| Total Complexity | 3 | 
| Total Lines | 32 | 
| Duplicated Lines | 71.88 % | 
| Changes | 0 | ||
Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | """kytos.cli.commands.users.parser tests."""  | 
            ||
| 2 | import sys  | 
            ||
| 3 | import unittest  | 
            ||
| 4 | from unittest.mock import patch  | 
            ||
| 5 | |||
| 6 | from kytos.cli.commands.users.parser import call, parse  | 
            ||
| 7 | |||
| 8 | |||
| 9 | View Code Duplication | 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 |