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