From 5b73251c8f621a19beb066ab31ea1ae15d021ee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Vidal=20Garc=C3=ADa?= Date: Fri, 22 Nov 2019 14:52:03 +0100 Subject: [PATCH] tests: fix record and files creation tests --- .../tests/api/test_api_record_files.py | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/{{cookiecutter.project_shortname}}/tests/api/test_api_record_files.py b/{{cookiecutter.project_shortname}}/tests/api/test_api_record_files.py index 2879e7a..873ebe5 100644 --- a/{{cookiecutter.project_shortname}}/tests/api/test_api_record_files.py +++ b/{{cookiecutter.project_shortname}}/tests/api/test_api_record_files.py @@ -49,19 +49,20 @@ def _get_record(client, pid_value): def test_record_creation(client, location): """Test create record using REST API.""" pid_value, rec = _create_record(client) - assert rec["_bucket"] - assert "_files" not in rec + assert "_bucket" not in rec + assert "files" not in rec + assert "$schema" not in rec['metadata'] # retrieve record rec = _get_record(client, pid_value) - assert rec["_bucket"] - assert "_files" not in rec + assert "_bucket" not in rec + assert "files" not in rec + assert "$schema" not in rec['metadata'] def test_files_creation_deletion(client, location): """Test that files are in record metadata.""" - pid_value, rec = _create_record(client) - bucket_id = rec["_bucket"] + pid_value, _ = _create_record(client) # add a file headers = [("Content-Type", "application/octet-stream")] @@ -72,9 +73,9 @@ def test_files_creation_deletion(client, location): # retrieve record and files rec = _get_record(client, pid_value) - assert rec["_bucket"] == bucket_id - assert rec["_files"] - first_file = rec["_files"][0] + assert "_bucket" not in rec + assert "files" in rec + first_file = rec["files"][0] first_file["key"] = "test.jpg" # Check if the files link is present @@ -89,5 +90,5 @@ def test_files_creation_deletion(client, location): # retrieve record and files rec = _get_record(client, pid_value) - assert rec["_bucket"] == bucket_id - assert rec["_files"] == [] + assert "_bucket" not in rec + assert rec["files"] == []