Code Duplication    Length = 24-24 lines in 2 locations

tests/unit/test_napps.py 2 locations

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