Code Duplication    Length = 24-24 lines in 2 locations

tests/unit/test_napps.py 2 locations

@@ 139-162 (lines=24) @@
136
            self.assertEqual(get_return[0][1], 'of_core')
137
            self.assertEqual(mock_prop_enabled.call_count, 1)
138
139
    def test_get_installed_local(self):
140
        """Test get_installed_local used to find
141
        installed napps in local machine"""
142
        # Mock kytos.json path
143
        mock_path = Mock()
144
145
        def glob_side_effect(args):
146
            """Path.glob to mock finding paths with kytos.json file."""
147
            self.assertEqual(args, "*/*/kytos.json")
148
149
            mock_path1 = Mock()
150
            mock_path1.parts = ['kytos', 'of_core', 'kytos.json']
151
            return [mock_path1]
152
        mock_path.glob = glob_side_effect
153
154
        mock_prop_installed = PropertyMock()
155
        with patch.object(NAppsManager, '_installed', mock_prop_installed):
156
            mock_prop_installed.return_value = mock_path
157
158
            get_return = self.napps_manager.get_installed_local()
159
160
            self.assertEqual(get_return[0][0], 'kytos')
161
            self.assertEqual(get_return[0][1], 'of_core')
162
            self.assertEqual(mock_prop_installed.call_count, 1)
163
164
    @patch('urllib.request.urlopen')
165
    def test_get_installed(self, mock_urlopen):
@@ 114-137 (lines=24) @@
111
        self.assertEqual(get_return[1][0], 'kytos')
112
        self.assertEqual(get_return[1][1], 'of_lldp')
113
114
    def test_get_enabled_local(self):
115
        """Test get_enabled_local used to find
116
        enabled napps in local machine"""
117
        # Mock kytos.json path
118
        mock_path = Mock()
119
120
        def glob_side_effect(args):
121
            """Path.glob to mock finding paths with kytos.json file."""
122
            self.assertEqual(args, "*/*/kytos.json")
123
124
            mock_path1 = Mock()
125
            mock_path1.parts = ['kytos', 'of_core', 'kytos.json']
126
            return [mock_path1]
127
        mock_path.glob = glob_side_effect
128
129
        mock_prop_enabled = PropertyMock()
130
        with patch.object(NAppsManager, '_enabled', mock_prop_enabled):
131
            mock_prop_enabled.return_value = mock_path
132
133
            get_return = self.napps_manager.get_enabled_local()
134
135
            self.assertEqual(get_return[0][0], 'kytos')
136
            self.assertEqual(get_return[0][1], 'of_core')
137
            self.assertEqual(mock_prop_enabled.call_count, 1)
138
139
    def test_get_installed_local(self):
140
        """Test get_installed_local used to find