Code Duplication    Length = 12-12 lines in 3 locations

tests/test_tpm.py 3 locations

@@ 323-334 (lines=12) @@
320
            response = sorted(self.client.list_passwords_archived(), key=lambda k: k['id'])
321
        self.assertEqual(data, response)
322
323
    def test_function_list_passwords_favorite(self):
324
        """Test function list_passwords_favorite."""
325
        path_to_mock = 'passwords/favorite.json'
326
        request_url = api_url + path_to_mock
327
        request_path = local_path + path_to_mock
328
        resource_file = os.path.normpath(request_path)
329
        data_file = open(resource_file)
330
        data = sorted(json.load(data_file), key=lambda k: k['id'])
331
        with requests_mock.Mocker() as m:
332
            fake_data(request_url, m)
333
            response = sorted(self.client.list_passwords_favorite(), key=lambda k: k['id'])
334
        self.assertEqual(data, response)
335
336
    def test_function_list_passwords_search(self):
337
        """Test function list_passwords_search."""
@@ 310-321 (lines=12) @@
307
            response = sorted(self.client.list_passwords(), key=lambda k: k['id'])
308
        self.assertEqual(data, response)
309
310
    def test_function_list_passwords_archived(self):
311
        """Test function list_passwords_archived."""
312
        path_to_mock = 'passwords/archived.json'
313
        request_url = api_url + path_to_mock
314
        request_path = local_path + path_to_mock
315
        resource_file = os.path.normpath(request_path)
316
        data_file = open(resource_file)
317
        data = sorted(json.load(data_file), key=lambda k: k['id'])
318
        with requests_mock.Mocker() as m:
319
            fake_data(request_url, m)
320
            response = sorted(self.client.list_passwords_archived(), key=lambda k: k['id'])
321
        self.assertEqual(data, response)
322
323
    def test_function_list_passwords_favorite(self):
324
        """Test function list_passwords_favorite."""
@@ 297-308 (lines=12) @@
294
    def setUp(self):
295
        self.client = tpm.TpmApiv4('https://tpm.example.com', username='USER', password='PASS')
296
297
    def test_function_list_passwords(self):
298
        """Test function list_passwords."""
299
        path_to_mock = 'passwords.json'
300
        request_url = api_url + path_to_mock
301
        request_path = local_path + path_to_mock
302
        resource_file = os.path.normpath(request_path)
303
        data_file = open(resource_file)
304
        data = sorted(json.load(data_file), key=lambda k: k['id'])
305
        with requests_mock.Mocker() as m:
306
            fake_data(request_url, m)
307
            response = sorted(self.client.list_passwords(), key=lambda k: k['id'])
308
        self.assertEqual(data, response)
309
310
    def test_function_list_passwords_archived(self):
311
        """Test function list_passwords_archived."""