Skip to content

Commit

Permalink
Merge pull request #25 from CybercentreCanada/update/remove_test_json
Browse files Browse the repository at this point in the history
Removing the result json from unit test [dev]
  • Loading branch information
cccs-kevin authored May 31, 2022
2 parents 53d39e5 + 785703d commit b12e821
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.

This file was deleted.

25 changes: 0 additions & 25 deletions test/test_metadefender.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,31 +425,6 @@ def test_execute(sample, metadefender_class_instance, mocker):
# Actually executing the sample
metadefender_class_instance.execute(service_request)

# Get the result of execute() from the test method
test_result = task.get_service_result()

# Get the assumed "correct" result of the sample
correct_result_path = os.path.join(TEST_DIR, "results", task.file_name + ".json")
with open(correct_result_path, "r") as f:
correct_result = json.loads(f.read())
f.close()

# Assert that the appropriate sections of the dict are equal

# Avoiding unique items in the response
test_result_response = test_result.pop("response")
correct_result_response = correct_result.pop("response")
assert test_result == correct_result

# Comparing everything in the response except for the service_completed and the output.json supplementary
test_result_response["milestones"].pop("service_completed")
correct_result_response["milestones"].pop("service_completed")
correct_result_response.pop("supplementary")
test_result_response.pop("supplementary")
correct_result_response.pop("service_context")
test_result_response.pop("service_context")
assert test_result_response == correct_result_response

# For coverage
metadefender_class_instance.config["max_node_time"] = 0
metadefender_class_instance.execute(service_request)
Expand Down

0 comments on commit b12e821

Please sign in to comment.