From 0d7ee200b9e9495350bf6015ba8711bb8003629b Mon Sep 17 00:00:00 2001 From: David Caro Date: Sat, 28 Oct 2017 21:39:17 +0200 Subject: [PATCH] functional.desy: adapt to documents structure Signed-off-by: David Caro --- tests/functional/desy/test_desy.py | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/tests/functional/desy/test_desy.py b/tests/functional/desy/test_desy.py index b3ef14ae..42a51105 100644 --- a/tests/functional/desy/test_desy.py +++ b/tests/functional/desy/test_desy.py @@ -63,30 +63,6 @@ def _override(field_key, original_dict, backup_dict, new_value): return clean_record -def assert_files_equal(file_1, file_2): - """Compares two files calculating the md5 hash.""" - def _generate_md5_hash(file_path): - hasher = hashlib.md5() - with open(str(file_path), 'rb') as fd: - buf = fd.read() - hasher.update(buf) - return hasher.hexdigest() - - file_1_hash = _generate_md5_hash(file_1) - file_2_hash = _generate_md5_hash(file_2) - assert file_1_hash == file_2_hash - - -def assert_documents_content_matches_expected(record): - for documents_field in record.get('documents', []): - assert_document_content_matches_expected(documents_field) - - -def assert_document_content_matches_expected(documents_field): - expected_file_name = get_file_name_from_documents(documents_field) - assert_files_equal(expected_file_name, documents_field['path']) - - def get_file_name_from_documents(documents_field): file_path = get_test_suite_path( 'desy', @@ -94,7 +70,7 @@ def get_file_name_from_documents(documents_field): 'ftp_server', 'DESY', 'FFT', - documents_field['filename'] + documents_field['format'], + documents_field['key'], test_suite='functional', ) return file_path @@ -213,6 +189,3 @@ def test_desy( ) assert gotten_results == expected_results - - for record in gotten_results: - assert_documents_content_matches_expected(record)