diff --git a/requirements-dev.in b/requirements-dev.in
index ed13bd27b3..629905d132 100644
--- a/requirements-dev.in
+++ b/requirements-dev.in
@@ -8,4 +8,3 @@ pytest-django
pytest-mock
pytest-randomly
tox
-vcrpy
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 9f8d0a0aab..53395c5bf8 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -110,7 +110,6 @@ idna==3.4
# via
# -r requirements.txt
# requests
- # yarl
importlib-metadata==6.8.0
# via
# -r requirements.txt
@@ -148,8 +147,6 @@ mockldap @ git+https://github.com/artefactual-labs/mockldap@v0.3.1
# via -r requirements-dev.in
mozilla-django-oidc==3.0.0
# via -r requirements.txt
-multidict==6.0.4
- # via yarl
mysqlclient==2.2.0
# via
# -r requirements.txt
@@ -241,8 +238,6 @@ pytz==2023.3.post1
# via
# -r requirements.txt
# django
-pyyaml==6.0.1
- # via vcrpy
referencing==0.30.2
# via
# -r requirements.txt
@@ -296,9 +291,6 @@ urllib3==1.26.17
# amclient
# elasticsearch
# requests
- # vcrpy
-vcrpy==5.1.0
- # via -r requirements-dev.in
virtualenv==20.24.5
# via tox
wheel==0.41.2
@@ -307,10 +299,6 @@ wheel==0.41.2
# pip-tools
whitenoise==6.6.0
# via -r requirements.txt
-wrapt==1.15.0
- # via vcrpy
-yarl==1.9.2
- # via vcrpy
zipp==3.17.0
# via
# -r requirements.txt
diff --git a/src/MCPClient/tests/fixtures/test_no_files_in_db.yaml b/src/MCPClient/tests/fixtures/test_no_files_in_db.yaml
deleted file mode 100644
index 1aa296a81b..0000000000
--- a/src/MCPClient/tests/fixtures/test_no_files_in_db.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-interactions:
-- request:
- body: password=admin
- headers:
- Accept: ['*/*']
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- Content-Length: ['14']
- Content-Type: [application/x-www-form-urlencoded]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-43-generic]
- method: POST
- uri: http://localhost:8089/users/admin/login
- response:
- body: {string: !!python/unicode '{"session":"88373637ab6bd52646d959ad310c1f281fb4ba02073e64c3f4da50b43d67b24a","user":{"lock_version":1159,"username":"admin","name":"Administrator","is_system_user":true,"create_time":"2014-12-05T20:32:17Z","system_mtime":"2015-07-09T23:18:47Z","user_mtime":"2015-07-09T23:18:47Z","jsonmodel_type":"user","groups":[],"is_admin":false,"uri":"/users/1","agent_record":{"ref":"/agents/people/1"},"permissions":{"/repositories/2":["view_repository","update_accession_record","update_resource_record","update_digital_object_record"],"_archivesspace":[]}}}
-
- '}
- headers:
- cache-control: ['private, must-revalidate, max-age=0']
- content-length: ['551']
- content-type: [application/json]
- date: ['Thu, 09 Jul 2015 23:18:47 GMT']
- server: [Jetty(8.1.5.v20120716)]
- x-content-type-options: [nosniff]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/MCPClient/tests/fixtures/test_parse_archivesspace_ids.yaml b/src/MCPClient/tests/fixtures/test_parse_archivesspace_ids.yaml
deleted file mode 100644
index e4081bdef6..0000000000
--- a/src/MCPClient/tests/fixtures/test_parse_archivesspace_ids.yaml
+++ /dev/null
@@ -1,48 +0,0 @@
-interactions:
-- request:
- body: password=admin
- headers:
- Accept: ['*/*']
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- Content-Length: ['14']
- Content-Type: [application/x-www-form-urlencoded]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-43-generic]
- method: POST
- uri: http://localhost:8089/users/admin/login
- response:
- body: {string: !!python/unicode '{"session":"4a108561f24f7850cb136cd765405fd563853b39b626e7cf3bfc4a99ef2bab0c","user":{"lock_version":898,"username":"admin","name":"Administrator","is_system_user":true,"create_time":"2014-12-05T20:32:17Z","system_mtime":"2015-07-08T21:38:45Z","user_mtime":"2015-07-08T21:38:45Z","jsonmodel_type":"user","groups":[],"is_admin":false,"uri":"/users/1","agent_record":{"ref":"/agents/people/1"},"permissions":{"/repositories/2":["view_repository","update_accession_record","update_resource_record","update_digital_object_record"],"_archivesspace":[]}}}
-
- '}
- headers:
- cache-control: ['private, must-revalidate, max-age=0']
- content-length: ['550']
- content-type: [application/json]
- date: ['Wed, 08 Jul 2015 21:38:45 GMT']
- server: [Jetty(8.1.5.v20120716)]
- x-content-type-options: [nosniff]
- status: {code: 200, message: OK}
-- request:
- body: null
- headers:
- Accept: ['*/*']
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-43-generic]
- X-ArchivesSpace-Session: [!!python/unicode '4a108561f24f7850cb136cd765405fd563853b39b626e7cf3bfc4a99ef2bab0c']
- method: GET
- uri: http://localhost:8089/repositories/2/find_by_id/archival_objects?resolve%5B%5D=archival_objects&ref_id%5B%5D=a118514fab1b2ee6a7e9ad259e1de355
- response:
- body: {string: !!python/unicode '{"archival_objects":[{"ref":"/repositories/2/archival_objects/752250","_resolved":{"lock_version":0,"position":0,"publish":true,"ref_id":"a118514fab1b2ee6a7e9ad259e1de355","component_id":"test111","title":"Test
- AO","display_string":"Test AO","restrictions_apply":false,"created_by":"admin","last_modified_by":"admin","create_time":"2015-09-22T18:35:41Z","system_mtime":"2015-09-22T18:35:41Z","user_mtime":"2015-09-22T18:35:41Z","suppressed":false,"level":"file","jsonmodel_type":"archival_object","external_ids":[],"subjects":[],"linked_events":[],"extents":[],"dates":[],"external_documents":[],"rights_statements":[],"linked_agents":[],"instances":[],"notes":[],"uri":"/repositories/2/archival_objects/752250","repository":{"ref":"/repositories/2"},"resource":{"ref":"/repositories/2/resources/11319"},"has_unpublished_ancestor":false}}]}
-
- '}
- headers:
- cache-control: ['private, must-revalidate, max-age=0']
- content-length: ['841']
- content-type: [application/json]
- date: ['Wed, 08 Jul 2015 21:38:45 GMT']
- server: [Jetty(8.1.5.v20120716)]
- x-content-type-options: [nosniff]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/MCPClient/tests/fixtures/vcr_cassettes/test_bind_pid_to_files.yaml b/src/MCPClient/tests/fixtures/vcr_cassettes/test_bind_pid_to_files.yaml
deleted file mode 100644
index 9cd598ce6c..0000000000
--- a/src/MCPClient/tests/fixtures/vcr_cassettes/test_bind_pid_to_files.yaml
+++ /dev/null
@@ -1,65 +0,0 @@
-interactions:
-- request:
- body: !!python/object/new:django.utils.safestring.SafeText
- - !!python/unicode "\r\n \r\n
- \ \r\n \r\n 12345\r\n
- \ \r\n 12345/06da9555-dc5b-425c-b967-6f30a740f1c3\r\n
- \ \r\n \r\n
- \ \r\n \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n "
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Authorization:
- - !!python/unicode bearer 84214c59-8694-48d5-89b5-d40a88cd7768
- Connection:
- - keep-alive
- Content-Length:
- - '1711'
- Content-Type:
- - !!python/unicode text/xml
- User-Agent:
- - python-requests/2.21.0
- method: POST
- uri: https://pid.socialhistoryservices.org/secure
- response:
- body:
- string: !!python/unicode 12345/06DA9555-DC5B-425C-B967-6F30A740F1C3
- headers:
- accept:
- - text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
- connection:
- - keep-alive
- content-length:
- - '881'
- content-type:
- - text/xml;charset=utf-8
- date:
- - Thu, 02 May 2019 12:44:02 GMT
- server:
- - nginx
- soapaction:
- - '""'
- status:
- code: 200
- message: OK
-version: 1
diff --git a/src/MCPClient/tests/fixtures/vcr_cassettes/test_bind_pids_to_sip_and_dirs.yaml b/src/MCPClient/tests/fixtures/vcr_cassettes/test_bind_pids_to_sip_and_dirs.yaml
deleted file mode 100644
index e6c55fccf2..0000000000
--- a/src/MCPClient/tests/fixtures/vcr_cassettes/test_bind_pids_to_sip_and_dirs.yaml
+++ /dev/null
@@ -1,183 +0,0 @@
-interactions:
-- request:
- body: !!python/object/new:django.utils.safestring.SafeText
- - !!python/unicode "\r\n \r\n
- \ \r\n \r\n 12345\r\n
- \ \r\n 12345/cb5ebaf5-beda-40b4-8d0c-fefbd546b8de\r\n
- \ \r\n \r\n
- \ \r\n \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n "
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Authorization:
- - !!python/unicode bearer 84214c59-8694-48d5-89b5-d40a88cd7768
- Connection:
- - keep-alive
- Content-Length:
- - '1098'
- Content-Type:
- - !!python/unicode text/xml
- User-Agent:
- - python-requests/2.21.0
- method: POST
- uri: https://pid.socialhistoryservices.org/secure
- response:
- body:
- string: !!python/unicode 12345/CB5EBAF5-BEDA-40B4-8D0C-FEFBD546B8DE
- headers:
- accept:
- - text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
- connection:
- - keep-alive
- content-length:
- - '594'
- content-type:
- - text/xml;charset=utf-8
- date:
- - Thu, 02 May 2019 13:08:30 GMT
- server:
- - nginx
- soapaction:
- - '""'
- status:
- code: 200
- message: OK
-- request:
- body: !!python/object/new:django.utils.safestring.SafeText
- - !!python/unicode "\r\n \r\n
- \ \r\n \r\n 12345\r\n
- \ \r\n 12345/966755bd-0ae3-4f85-b4ec-b359fefeff33\r\n
- \ \r\n \r\n
- \ \r\n \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n "
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Authorization:
- - !!python/unicode bearer 84214c59-8694-48d5-89b5-d40a88cd7768
- Connection:
- - keep-alive
- Content-Length:
- - '1711'
- Content-Type:
- - !!python/unicode text/xml
- User-Agent:
- - python-requests/2.21.0
- method: POST
- uri: https://pid.socialhistoryservices.org/secure
- response:
- body:
- string: !!python/unicode 12345/966755BD-0AE3-4F85-B4EC-B359FEFEFF33
- headers:
- accept:
- - text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
- connection:
- - keep-alive
- content-length:
- - '881'
- content-type:
- - text/xml;charset=utf-8
- date:
- - Thu, 02 May 2019 13:08:30 GMT
- server:
- - nginx
- soapaction:
- - '""'
- status:
- code: 200
- message: OK
-- request:
- body: !!python/object/new:django.utils.safestring.SafeText
- - !!python/unicode "\r\n \r\n
- \ \r\n \r\n 12345\r\n
- \ \r\n 12345/d298dd3f-c5d1-4445-99fe-09123fba8b30\r\n
- \ \r\n \r\n
- \ \r\n \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n
- \ \r\n \r\n "
- headers:
- Accept:
- - '*/*'
- Accept-Encoding:
- - gzip, deflate
- Authorization:
- - !!python/unicode bearer 84214c59-8694-48d5-89b5-d40a88cd7768
- Connection:
- - keep-alive
- Content-Length:
- - '1711'
- Content-Type:
- - !!python/unicode text/xml
- User-Agent:
- - python-requests/2.21.0
- method: POST
- uri: https://pid.socialhistoryservices.org/secure
- response:
- body:
- string: !!python/unicode 12345/D298DD3F-C5D1-4445-99FE-09123FBA8B30
- headers:
- accept:
- - text/xml, text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
- connection:
- - keep-alive
- content-length:
- - '881'
- content-type:
- - text/xml;charset=utf-8
- date:
- - Thu, 02 May 2019 13:08:30 GMT
- server:
- - nginx
- soapaction:
- - '""'
- status:
- code: 200
- message: OK
-version: 1
diff --git a/src/MCPClient/tests/fixtures/vcr_cassettes/test_dspace_handle_to_archivesspace.yaml b/src/MCPClient/tests/fixtures/vcr_cassettes/test_dspace_handle_to_archivesspace.yaml
deleted file mode 100644
index 05b0436c23..0000000000
--- a/src/MCPClient/tests/fixtures/vcr_cassettes/test_dspace_handle_to_archivesspace.yaml
+++ /dev/null
@@ -1,117 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept-Encoding: ['gzip, deflate']
- Authorization: ['ApiKey test:326e86562d76b1db4a2479eccfd76d35a1d2fb5e']
- Connection: [keep-alive]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-91-generic]
- accept: [application/json]
- content-type: [application/json]
- method: GET
- uri: http://localhost:8000/api/v2/file/?uuid=4060ee97-9c3f-4822-afaf-ebdf838284c3&offset=0
- response:
- body: {string: !!python/unicode '{"meta": {"limit": 20, "next": null, "offset":
- 0, "previous": null, "total_count": 1}, "objects": [{"current_full_path":
- "http:/dspace5x.archivematica.org:8080/swordv2/collection/123456789/2/http:/dspace5x.archivematica.org:8080/swordv2/statement/92.atom",
- "current_location": "/api/v2/location/758cf517-45f7-4c78-8074-32c686c653cb/",
- "current_path": "http://dspace5x.archivematica.org:8080/swordv2/statement/92.atom",
- "misc_attributes": {"handle": "123456789/41"}, "origin_pipeline": "/api/v2/pipeline/32836b5b-950e-4409-a823-830d2dd01026/",
- "package_type": "AIP", "related_packages": [], "resource_uri": "/api/v2/file/4060ee97-9c3f-4822-afaf-ebdf838284c3/",
- "size": 21244662, "status": "UPLOADED", "uuid": "4060ee97-9c3f-4822-afaf-ebdf838284c3"}]}'}
- headers:
- cache-control: [no-cache]
- content-type: [application/json]
- date: ['Tue, 20 Sep 2016 23:11:32 GMT']
- server: [WSGIServer/0.1 Python/2.7.6]
- vary: ['Accept, Cookie']
- x-frame-options: [SAMEORIGIN]
- status: {code: 200, message: OK}
-- request:
- body: null
- headers:
- Accept: ['*/*']
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- Content-Length: ['0']
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-91-generic]
- method: POST
- uri: http://localhost:8089/users/admin/login?password=admin
- response:
- body: {string: !!python/unicode '{"session":"57823397705778ab52fea1cbb1a690c46218dfb0277ed021f496849dc328d37b","user":{"lock_version":6298,"username":"admin","name":"Administrator","is_system_user":true,"create_time":"2015-09-22T18:46:11Z","system_mtime":"2016-09-20T23:11:32Z","user_mtime":"2016-09-20T23:11:32Z","jsonmodel_type":"user","groups":[],"is_admin":true,"uri":"/users/1","agent_record":{"ref":"/agents/people/1"},"permissions":{"/repositories/1":["update_location_record","delete_vocabulary_record","update_subject_record","delete_subject_record","update_agent_record","delete_agent_record","update_vocabulary_record","merge_subject_record","merge_agent_record","system_config","administer_system","manage_users","become_user","view_all_records","create_repository","delete_repository","transfer_repository","index_system","manage_repository","update_accession_record","update_resource_record","update_digital_object_record","update_event_record","delete_event_record","suppress_archival_record","transfer_archival_record","delete_archival_record","view_suppressed","view_repository","update_classification_record","delete_classification_record","mediate_edits","import_records","cancel_importer_job","manage_subject_record","manage_agent_record","manage_vocabulary_record","merge_agents_and_subjects","merge_archival_record","manage_rde_templates"],"_archivesspace":["system_config","administer_system","manage_users","become_user","view_all_records","create_repository","delete_repository","transfer_repository","index_system","manage_repository","update_accession_record","update_resource_record","update_digital_object_record","update_event_record","delete_event_record","suppress_archival_record","transfer_archival_record","delete_archival_record","view_suppressed","view_repository","update_classification_record","delete_classification_record","mediate_edits","import_records","cancel_importer_job","manage_subject_record","manage_agent_record","manage_vocabulary_record","merge_agents_and_subjects","merge_archival_record","manage_rde_templates","update_location_record","delete_vocabulary_record","update_subject_record","delete_subject_record","update_agent_record","delete_agent_record","update_vocabulary_record","merge_subject_record","merge_agent_record"]}}}
-
-'}
- headers:
- cache-control: ['private, must-revalidate, max-age=0']
- content-length: ['2253']
- content-type: [application/json]
- date: ['Tue, 20 Sep 2016 23:11:32 GMT']
- server: [Jetty(8.1.5.v20120716)]
- x-content-type-options: [nosniff]
- status: {code: 200, message: OK}
-- request:
- body: null
- headers:
- Accept: ['*/*']
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-91-generic]
- X-ArchivesSpace-Session: [!!python/unicode 57823397705778ab52fea1cbb1a690c46218dfb0277ed021f496849dc328d37b]
- method: GET
- uri: http://localhost:8089/repositories/2/digital_objects/211
- response:
- body: {string: !!python/unicode '{"lock_version":4,"digital_object_id":"ac256851-ba50-4c99-a488-25fa442ed242","title":"misty-test-1","publish":false,"restrictions":false,"created_by":"admin","last_modified_by":"admin","create_time":"2016-09-20T18:22:56Z","system_mtime":"2016-09-20T18:48:06Z","user_mtime":"2016-09-20T18:48:06Z","suppressed":false,"digital_object_type":"text","jsonmodel_type":"digital_object","external_ids":[],"subjects":[],"linked_events":[],"extents":[],"dates":[],"external_documents":[],"rights_statements":[],"linked_agents":[],"file_versions":[{"lock_version":0,"file_uri":"123456789/41","created_by":"admin","last_modified_by":"admin","create_time":"2016-09-20T18:48:06Z","system_mtime":"2016-09-20T18:48:06Z","user_mtime":"2016-09-20T18:48:06Z","use_statement":"text-data","xlink_actuate_attribute":"none","xlink_show_attribute":"embed","jsonmodel_type":"file_version","identifier":"289"},{"lock_version":0,"file_uri":"123456789/41","created_by":"admin","last_modified_by":"admin","create_time":"2016-09-20T18:48:06Z","system_mtime":"2016-09-20T18:48:06Z","user_mtime":"2016-09-20T18:48:06Z","use_statement":"text-data","xlink_actuate_attribute":"none","xlink_show_attribute":"embed","jsonmodel_type":"file_version","identifier":"290"}],"notes":[],"linked_instances":[{"ref":"/repositories/2/archival_objects/8887"}],"uri":"/repositories/2/digital_objects/211","repository":{"ref":"/repositories/2"},"tree":{"ref":"/repositories/2/digital_objects/211/tree"}}
-
-'}
- headers:
- cache-control: ['private, must-revalidate, max-age=0']
- content-length: ['1453']
- content-type: [application/json]
- date: ['Tue, 20 Sep 2016 23:11:32 GMT']
- server: [Jetty(8.1.5.v20120716)]
- x-content-type-options: [nosniff]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"lock_version": 4, "system_mtime": "2016-09-20T18:48:06Z",
- "extents": [], "jsonmodel_type": "digital_object", "create_time": "2016-09-20T18:22:56Z",
- "publish": false, "repository": {"ref": "/repositories/2"}, "linked_instances":
- [{"ref": "/repositories/2/archival_objects/8887"}], "title": "misty-test-1",
- "created_by": "admin", "subjects": [], "external_documents": [], "linked_agents":
- [], "digital_object_type": "text", "file_versions": [{"lock_version": 0, "system_mtime":
- "2016-09-20T18:48:06Z", "xlink_show_attribute": "embed", "jsonmodel_type": "file_version",
- "file_uri": "123456789/41", "user_mtime": "2016-09-20T18:48:06Z", "last_modified_by":
- "admin", "create_time": "2016-09-20T18:48:06Z", "xlink_actuate_attribute": "none",
- "created_by": "admin", "use_statement": "text-data", "identifier": "289"}, {"lock_version":
- 0, "system_mtime": "2016-09-20T18:48:06Z", "xlink_show_attribute": "embed",
- "jsonmodel_type": "file_version", "file_uri": "123456789/41", "user_mtime":
- "2016-09-20T18:48:06Z", "last_modified_by": "admin", "create_time": "2016-09-20T18:48:06Z",
- "xlink_actuate_attribute": "none", "created_by": "admin", "use_statement": "text-data",
- "identifier": "290"}, {"file_uri": "123456789/41", "xlink_actuate_attribute":
- "none", "xlink_show_attribute": "embed", "use_statement": "text-data"}], "user_mtime":
- "2016-09-20T18:48:06Z", "rights_statements": [], "linked_events": [], "external_ids":
- [], "suppressed": false, "restrictions": false, "dates": [], "notes": [], "tree":
- {"ref": "/repositories/2/digital_objects/211/tree"}, "uri": "/repositories/2/digital_objects/211",
- "last_modified_by": "admin", "digital_object_id": "ac256851-ba50-4c99-a488-25fa442ed242"}'
- headers:
- Accept: ['*/*']
- Accept-Encoding: ['gzip, deflate']
- Connection: [keep-alive]
- Content-Length: ['1683']
- Content-Type: [application/json]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-91-generic]
- X-ArchivesSpace-Session: [!!python/unicode 57823397705778ab52fea1cbb1a690c46218dfb0277ed021f496849dc328d37b]
- method: POST
- uri: http://localhost:8089/repositories/2/digital_objects/211
- response:
- body: {string: !!python/unicode '{"status":"Updated","id":211,"lock_version":5,"stale":null,"uri":"/repositories/2/digital_objects/211","warnings":[]}
-
-'}
- headers:
- cache-control: ['private, must-revalidate, max-age=0']
- content-length: ['118']
- content-type: [application/json]
- date: ['Tue, 20 Sep 2016 23:11:33 GMT']
- server: [Jetty(8.1.5.v20120716)]
- x-content-type-options: [nosniff]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/MCPClient/tests/fixtures/vcr_cassettes/test_no_dspace.yaml b/src/MCPClient/tests/fixtures/vcr_cassettes/test_no_dspace.yaml
deleted file mode 100644
index 29d944dcbf..0000000000
--- a/src/MCPClient/tests/fixtures/vcr_cassettes/test_no_dspace.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- Accept-Encoding: ['gzip, deflate']
- Authorization: ['ApiKey test:326e86562d76b1db4a2479eccfd76d35a1d2fb5e']
- Connection: [keep-alive]
- User-Agent: [python-requests/2.7.0 CPython/2.7.6 Linux/3.13.0-91-generic]
- accept: [application/json]
- content-type: [application/json]
- method: GET
- uri: http://localhost:8000/api/v2/file/?uuid=4060ee97-9c3f-4822-afaf-ebdf838284c3&offset=0
- response:
- body: {string: !!python/unicode '{"meta": {"limit": 20, "next": null, "offset":
- 0, "previous": null, "total_count": 1}, "objects": [{"current_full_path":
- "http:/dspace5x.archivematica.org:8080/swordv2/collection/123456789/2/http:/dspace5x.archivematica.org:8080/swordv2/statement/92.atom",
- "current_location": "/api/v2/location/758cf517-45f7-4c78-8074-32c686c653cb/",
- "current_path": "http://dspace5x.archivematica.org:8080/swordv2/statement/92.atom",
- "misc_attributes": {}, "origin_pipeline": "/api/v2/pipeline/32836b5b-950e-4409-a823-830d2dd01026/",
- "package_type": "AIP", "related_packages": [], "resource_uri": "/api/v2/file/4060ee97-9c3f-4822-afaf-ebdf838284c3/",
- "size": 21244662, "status": "UPLOADED", "uuid": "4060ee97-9c3f-4822-afaf-ebdf838284c3"}]}'}
- headers:
- cache-control: [no-cache]
- content-type: [application/json]
- date: ['Tue, 20 Sep 2016 23:11:32 GMT']
- server: [WSGIServer/0.1 Python/2.7.6]
- vary: ['Accept, Cookie']
- x-frame-options: [SAMEORIGIN]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/MCPClient/tests/test_dip_generation_helper.py b/src/MCPClient/tests/test_dip_generation_helper.py
index f0ba76ac84..98daa2651d 100644
--- a/src/MCPClient/tests/test_dip_generation_helper.py
+++ b/src/MCPClient/tests/test_dip_generation_helper.py
@@ -1,7 +1,7 @@
#!/usr/bin/env python
import os
+from unittest import mock
-import vcr
from django.test import TestCase
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -31,7 +31,6 @@ def test_empty_csv(self):
assert rc == 1
assert ArchivesSpaceDIPObjectResourcePairing.objects.all().exists() is False
- @vcr.use_cassette(os.path.join(THIS_DIR, "fixtures", "test_no_files_in_db.yaml"))
def test_no_files_in_db(self):
"""It should do nothing if no files are found in the DB."""
sip_path = os.path.join(THIS_DIR, "fixtures", "metadata_csv_sip", "")
@@ -41,10 +40,17 @@ def test_no_files_in_db(self):
assert rc == 0
assert ArchivesSpaceDIPObjectResourcePairing.objects.all().exists() is False
- @vcr.use_cassette(
- os.path.join(THIS_DIR, "fixtures", "test_parse_archivesspace_ids.yaml")
+ @mock.patch(
+ "dip_generation_helper.create_archivesspace_client",
+ return_value=mock.Mock(
+ **{
+ "find_by_id.return_value": [
+ {"id": "/repositories/2/archival_objects/752250"}
+ ]
+ }
+ ),
)
- def test_parse_to_db(self):
+ def test_parse_to_db(self, create_archivesspace_client):
"""
It should create an entry in ArchivesSpaceDIPObjectResourcePairing for each file in archivesspaceids.csv
It should match the reference ID to a resource ID.
diff --git a/src/MCPClient/tests/test_pid_components.py b/src/MCPClient/tests/test_pid_components.py
index 70e05682aa..2f4697fc85 100644
--- a/src/MCPClient/tests/test_pid_components.py
+++ b/src/MCPClient/tests/test_pid_components.py
@@ -8,30 +8,22 @@
import os
from itertools import chain
+import bind_pid
+import bind_pids
+import create_mets_v2
+import namespaces as ns
import pytest
-import vcr
from job import Job
from main.models import DashboardSetting
from main.models import Directory
from main.models import File
from main.models import SIP
from main.models import Transfer
-
+from pid_declaration import DeclarePIDs
+from pid_declaration import DeclarePIDsException
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
-vcr_cassettes = vcr.VCR(
- cassette_library_dir=os.path.join(THIS_DIR, "fixtures", "vcr_cassettes"),
- path_transformer=vcr.VCR.ensure_suffix(".yaml"),
-)
-
-import bind_pid
-import bind_pids
-import create_mets_v2
-import namespaces as ns
-from pid_declaration import DeclarePIDs, DeclarePIDsException
-
-
PACKAGE_UUID = "cb5ebaf5-beda-40b4-8d0c-fefbd546b8de"
INCOMPLETE_CONFIG_MSG = "A value for parameter"
BOUND_URI = "http://195.169.88.240:8017/12345/"
@@ -257,6 +249,11 @@ def data(db, sip, settings, transfer, files, directories):
return
+@pytest.fixture
+def pid_web_service(mocker):
+ mocker.patch("requests.post", return_value=mocker.Mock(status_code=200))
+
+
@pytest.mark.django_db
def test_bind_pids_no_config(data, caplog, job):
"""Test the output of the code without any args.
@@ -275,7 +272,7 @@ def test_bind_pids_no_config(data, caplog, job):
@pytest.mark.django_db
-def test_bind_pids(data, mocker, job):
+def test_bind_pids(data, mocker, job, pid_web_service):
"""Test the bind_pids function end-to-end and ensure that the
result is that which is anticipated.
@@ -286,10 +283,10 @@ def test_bind_pids(data, mocker, job):
# test here using the package UUID, the function's fallback position.
mocker.patch.object(bind_pids, "_get_unique_acc_no", return_value=PACKAGE_UUID)
mocker.patch.object(bind_pids, "_validate_handle_server_config", return_value=None)
- with vcr_cassettes.use_cassette("test_bind_pids_to_sip_and_dirs.yaml") as cassette:
- # Primary entry-point for the bind_pids microservice job.
- bind_pids.main(job, PACKAGE_UUID, "")
- assert cassette.all_played
+
+ # Primary entry-point for the bind_pids microservice job.
+ bind_pids.main(job, PACKAGE_UUID, "")
+
sip_mdl = SIP.objects.filter(uuid=PACKAGE_UUID).first()
assert len(sip_mdl.identifiers.all()) == len(
BOUND_IDENTIFIER_TYPES
@@ -350,7 +347,7 @@ def test_bind_pid_no_config(data, caplog, job):
@pytest.mark.django_db
-def test_bind_pid(data, job):
+def test_bind_pid(data, job, pid_web_service):
"""Test the bind_pid function end-to-end and ensure that the
result is that which is anticipated.
@@ -369,9 +366,7 @@ def test_bind_pid(data, job):
package_files
), "Number of files returned from package is incorrect"
for file_ in files:
- with vcr_cassettes.use_cassette("test_bind_pid_to_files.yaml") as cassette:
- bind_pid.main(job, file_.pk)
- assert cassette.all_played
+ bind_pid.main(job, file_.pk)
for file_mdl in files:
bound = {idfr.type: idfr.value for idfr in file_mdl.identifiers.all()}
assert (
@@ -421,7 +416,7 @@ def test_bind_pid_no_settings(data, caplog, job):
@pytest.mark.django_db
-def test_pid_declaration(data, mocker, job):
+def test_pid_declaration(data, mocker, job, pid_web_service):
"""Test that the overall functionality of the PID declaration functions
work as expected.
"""
@@ -459,13 +454,10 @@ def test_pid_declaration(data, mocker, job):
assert example_uri in value, "Example URI type not preserved"
if key == PID_ULID:
assert len(example_ulid) == len(value)
- # Use the previous PID binding vcr cassettes to ensure declared PIDs can
- # co-exist with bound ones.
mocker.patch.object(bind_pids, "_get_unique_acc_no", return_value=PACKAGE_UUID)
mocker.patch.object(bind_pids, "_validate_handle_server_config", return_value=None)
- with vcr_cassettes.use_cassette("test_bind_pids_to_sip_and_dirs.yaml") as cassette:
- # Primary entry-point for the bind_pids microservice job.
- bind_pids.main(job, PACKAGE_UUID, "")
+ # Primary entry-point for the bind_pids microservice job.
+ bind_pids.main(job, PACKAGE_UUID, "")
for mdl in chain((sip_mdl,), dir_mdl):
dir_dmd_sec = create_mets_v2.getDirDmdSec(mdl, "")
id_type = dir_dmd_sec.xpath(
@@ -486,9 +478,7 @@ def test_pid_declaration(data, mocker, job):
if key == PID_ULID:
assert len(example_ulid) == len(value)
for file_ in files:
- with vcr_cassettes.use_cassette("test_bind_pid_to_files.yaml") as cassette:
- bind_pid.main(job, file_.pk)
- assert cassette.all_played
+ bind_pid.main(job, file_.pk)
for file_mdl in files:
file_level_premis = create_mets_v2.create_premis_object(file_mdl.pk)
id_type = file_level_premis.xpath(
diff --git a/src/MCPClient/tests/test_post_store_aip_hook.py b/src/MCPClient/tests/test_post_store_aip_hook.py
index 1bdc44d3f6..a118c8d7ea 100644
--- a/src/MCPClient/tests/test_post_store_aip_hook.py
+++ b/src/MCPClient/tests/test_post_store_aip_hook.py
@@ -1,7 +1,7 @@
import os
+from unittest import mock
import pytest
-import vcr
from django.test import TestCase
THIS_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -10,11 +10,6 @@
from main import models
-my_vcr = vcr.VCR(
- cassette_library_dir=os.path.join(THIS_DIR, "fixtures", "vcr_cassettes"),
- path_transformer=vcr.VCR.ensure_suffix(".yaml"),
-)
-
class TestDSpaceToArchivesSpace(TestCase):
"""Test sending the DSpace handle to ArchivesSpace."""
@@ -38,23 +33,53 @@ def test_no_archivesspace(self):
)
assert rc == 1
- def test_no_dspace(self):
+ @mock.patch(
+ "storageService.get_file_info",
+ return_value=[{"misc_attributes": {}}],
+ )
+ def test_no_dspace(self, get_file_info):
"""It should abort if no DSpace handle found."""
- with my_vcr.use_cassette("test_no_dspace.yaml") as c:
- rc = post_store_aip_hook.dspace_handle_to_archivesspace(
- Job("stub", "stub", []), self.sip_uuid
- )
- assert rc == 1
- assert c.all_played
-
- def test_dspace_handle_to_archivesspace(self):
+ rc = post_store_aip_hook.dspace_handle_to_archivesspace(
+ Job("stub", "stub", []), self.sip_uuid
+ )
+ assert rc == 1
+
+ @mock.patch(
+ "storageService.get_file_info",
+ return_value=[{"misc_attributes": {"handle": "123456789/41"}}],
+ )
+ @mock.patch(
+ "requests.post",
+ side_effect=[
+ mock.Mock(**{"json.return_value": {"session": "session-id"}}),
+ mock.Mock(status_code=200),
+ ],
+ )
+ @mock.patch(
+ "requests.get",
+ return_value=mock.Mock(
+ **{
+ "json.return_value": {
+ "file_versions": [
+ {
+ "file_uri": "123456789/41",
+ "use_statement": "text-data",
+ "xlink_actuate_attribute": "none",
+ "xlink_show_attribute": "embed",
+ },
+ ],
+ }
+ }
+ ),
+ )
+ def test_dspace_handle_to_archivesspace(
+ self, requests_get, requests_post, get_file_info
+ ):
"""It should send the DSpace handle to ArchivesSpace."""
- with my_vcr.use_cassette("test_dspace_handle_to_archivesspace.yaml") as c:
- rc = post_store_aip_hook.dspace_handle_to_archivesspace(
- Job("stub", "stub", []), self.sip_uuid
- )
- assert rc == 0
- assert c.all_played
+ rc = post_store_aip_hook.dspace_handle_to_archivesspace(
+ Job("stub", "stub", []), self.sip_uuid
+ )
+ assert rc == 0
@pytest.fixture
diff --git a/src/archivematicaCommon/tests/fixtures/test_delete_aip.yaml b/src/archivematicaCommon/tests/fixtures/test_delete_aip.yaml
deleted file mode 100644
index 39fdb2bc0b..0000000000
--- a/src/archivematicaCommon/tests/fixtures/test_delete_aip.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-interactions:
-- request:
- body: !!python/unicode '{"query":{"term":{"uuid":"b34521a3-1c63-43dd-b901-584416f36c91"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/aips/_search?_source=uuid
- response:
- body: {string: !!python/unicode '{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":0.2876821,"hits":[{"_index":"aips","_type":"_doc","_id":"lBsZBWgBn49OAVhMXeO8","_score":0.2876821,"_source":{"uuid":"b34521a3-1c63-43dd-b901-584416f36c91"}}]}}'}
- headers:
- content-length: ['277']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"query":{"term":{"uuid":"b34521a3-1c63-43dd-b901-584416f36c91"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: POST
- uri: http://elasticsearch:9200/aips/_delete_by_query
- response:
- body: {string: !!python/unicode '{"took":8,"timed_out":false,"total":1,"deleted":1,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}'}
- headers:
- content-length: ['215']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"query":{"term":{"uuid":"b34521a3-1c63-43dd-b901-584416f36c91"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/aips/_search?_source=uuid
- response:
- body: {string: !!python/unicode '{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
- headers:
- content-length: ['134']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/archivematicaCommon/tests/fixtures/test_delete_aip_files.yaml b/src/archivematicaCommon/tests/fixtures/test_delete_aip_files.yaml
deleted file mode 100644
index 38f27fe248..0000000000
--- a/src/archivematicaCommon/tests/fixtures/test_delete_aip_files.yaml
+++ /dev/null
@@ -1,109 +0,0 @@
-interactions:
-- request:
- body: !!python/unicode '{"query":{"term":{"AIPUUID":"b34521a3-1c63-43dd-b901-584416f36c91"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/aipfiles/_search
- response:
- body: {string: !!python/unicode '{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":2,"max_score":0.2876821,"hits":[{"_index":"aipfiles","_type":"_doc","_id":"lRsZBWgBn49OAVhMXuMC","_score":0.2876821,"_source":{"origin":"1a14043f-68ef-4bfe-a129-e2e4cdbe391b","METS":{"dmdSec":{"ns0:xmlData_dict_list":[{"@xmlns:ns1":"http://www.loc.gov/premis/v3","@xmlns:ns0":"http://www.loc.gov/METS/","@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","ns1:object_dict_list":[{"ns1:originalName":"20181231153024-b34521a3-1c63-43dd-b901-584416f36c91","@version":"3.0","@xsi:type":"premis:intellectualEntity","ns1:objectIdentifier_dict_list":[{"ns1:objectIdentifierType":"UUID","ns1:objectIdentifierValue":"b34521a3-1c63-43dd-b901-584416f36c91"}],"@xsi:schemaLocation":"http://www.loc.gov/premis/v3
- http://www.loc.gov/standards/premis/v3/premis.xsd"}]}]},"amdSec":{"ns0:amdSec_dict_list":[{"ns0:techMD_dict_list":[{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:OBJECT","ns0:xmlData_dict_list":[{"ns1:object_dict_list":[{"@version":"2.2","@xsi:type":"premis:file","ns1:objectCharacteristics_dict_list":[{"ns1:compositionLevel":"0","ns1:creatingApplication_dict_list":[{"ns1:dateCreatedByApplication":"2018-12-11"}],"ns1:size":"1361321","ns1:fixity_dict_list":[{"ns1:messageDigest":"a469c730e705d757d66f53f38bb4455e89d5691a3d87fc7bc069b91fa2a50d46","ns1:messageDigestAlgorithm":"sha256"}],"ns1:format_dict_list":[{"ns1:formatDesignation_dict_list":[{"ns1:formatName":"JPEG","ns1:formatVersion":"1.01"}],"ns1:formatRegistry_dict_list":[{"ns1:formatRegistryKey":"fmt/43","ns1:formatRegistryName":"PRONOM"}]}],"ns1:objectCharacteristicsExtension":null}],"ns1:originalName":"%transferDirectory%objects/Landing
- zone.jpg","ns1:relationship_dict_list":[{"ns1:relatedObjectIdentification_dict_list":[{"ns1:relatedObjectIdentifierType":"UUID","ns1:relatedObjectIdentifierValue":"ba0f9dab-6fd8-4e39-bac8-fe0492bc0a84"}],"ns1:relationshipType":"derivation","ns1:relationshipSubType":"is
- source of","ns1:relatedEventIdentification_dict_list":[{"ns1:relatedEventIdentifierValue":"488dc3f8-89d8-41bb-8dd4-6569b28981a9","ns1:relatedEventIdentifierType":"UUID"}]}],"ns1:objectIdentifier_dict_list":[{"ns1:objectIdentifierType":"UUID","ns1:objectIdentifierValue":"80624596-0c7d-436e-a5a0-5ca37c8ce417"}],"@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"techMD_2"}],"@xmlns:ns1":"info:lc/xmlns/premis-v2","@xmlns:ns0":"http://www.loc.gov/METS/","@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@ID":"amdSec_2","ns0:digiprovMD_dict_list":[{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":null}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"22822e01-4438-4e78-822e-a8a53e7412e9"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:34.773872+00:00","ns1:eventDetail":null,"ns1:eventType":"ingestion","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_6"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"a469c730e705d757d66f53f38bb4455e89d5691a3d87fc7bc069b91fa2a50d46"}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"23ba11bf-f51f-4e76-8101-40ced150bb12"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:35.144602+00:00","ns1:eventDetail":"program=\"python\";
- module=\"hashlib.sha256()\"","ns1:eventType":"message digest calculation","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_7"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":"Pass","ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":null}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"f3e14ac8-fd56-4fd2-b201-b1cb9fb45bee"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:39.496393+00:00","ns1:eventDetail":"program=\"ClamAV
- (clamd)\"; version=\"ClamAV 0.99.2\"; virusDefinitions=\"25255/Mon Dec 31
- 06:25:07 2018\"","ns1:eventType":"virus check","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_8"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"Original
- name=\"%transferDirectory%objects/Landing zone.jpg\"; cleaned up name=\"%transferDirectory%objects/Landing_zone.jpg\""}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"e914cd93-a32e-4e7c-a994-ab13059c2ac4"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:41.226291+00:00","ns1:eventDetail":"prohibited
- characters removed:program=\"sanitize_names\"; version=\"1.10.d0ccb7d7661cf35c769dcc0846d8f087998af713\"","ns1:eventType":"name
- cleanup","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2 http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_9"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":"Positive","ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"fmt/43"}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"1ae9453a-595f-40df-b0a8-f443af2c976a"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:43.662024+00:00","ns1:eventDetail":"program=\"Siegfried\";
- version=\"1.7.10\"","ns1:eventType":"format identification","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_10"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":"pass","ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"format=\"JPEG\";
- version=\"1.01\"; result=\"Well-Formed and valid\""}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"efa6d51a-d3e9-4dad-a612-82596c032795"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:48.839005+00:00","ns1:eventDetail":"program=\"JHOVE\";
- version=\"1.6\"","ns1:eventType":"validation","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_11"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"%SIPDirectory%objects/Landing_zone-ba0f9dab-6fd8-4e39-bac8-fe0492bc0a84.tif"}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"488dc3f8-89d8-41bb-8dd4-6569b28981a9"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:31:00.435014+00:00","ns1:eventDetail":"ArchivematicaFPRCommandID=\"a34ddc9b-c922-4bb6-8037-bbe713332175\";
- program=\"convert\"; version=\"Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
- http://www.imagemagick.org\"","ns1:eventType":"normalization","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_12"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:AGENT","ns0:xmlData_dict_list":[{"ns1:agent_dict_list":[{"ns1:agentIdentifier_dict_list":[{"ns1:agentIdentifierType":"preservation
- system","ns1:agentIdentifierValue":"Archivematica-1.9"}],"ns1:agentType":"software","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd","ns1:agentName":"Archivematica"}]}]}],"@ID":"digiprovMD_13"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:AGENT","ns0:xmlData_dict_list":[{"ns1:agent_dict_list":[{"ns1:agentIdentifier_dict_list":[{"ns1:agentIdentifierType":"repository
- code","ns1:agentIdentifierValue":"test"}],"ns1:agentType":"organization","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd","ns1:agentName":"test"}]}]}],"@ID":"digiprovMD_14"}]}]}},"FILEUUID":"80624596-0c7d-436e-a5a0-5ca37c8ce417","sipName":"20181231153024","filePath":"objects/Landing_zone.jpg","indexedAt":1546273775.097954,"identifiers":[],"AIPUUID":"b34521a3-1c63-43dd-b901-584416f36c91","isPartOf":null,"archivematicaVersion":"1.9","fileExtension":"jpg","transferMetadata":[],"AICID":null}},{"_index":"aipfiles","_type":"_doc","_id":"lhsZBWgBn49OAVhMXuMh","_score":0.2876821,"_source":{"origin":"1a14043f-68ef-4bfe-a129-e2e4cdbe391b","METS":{"dmdSec":{"ns0:xmlData_dict_list":[{"@xmlns:ns1":"http://www.loc.gov/premis/v3","@xmlns:ns0":"http://www.loc.gov/METS/","@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","ns1:object_dict_list":[{"ns1:originalName":"20181231153024-b34521a3-1c63-43dd-b901-584416f36c91","@version":"3.0","@xsi:type":"premis:intellectualEntity","ns1:objectIdentifier_dict_list":[{"ns1:objectIdentifierType":"UUID","ns1:objectIdentifierValue":"b34521a3-1c63-43dd-b901-584416f36c91"}],"@xsi:schemaLocation":"http://www.loc.gov/premis/v3
- http://www.loc.gov/standards/premis/v3/premis.xsd"}]}]},"amdSec":{"ns0:amdSec_dict_list":[{"ns0:techMD_dict_list":[{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:OBJECT","ns0:xmlData_dict_list":[{"ns1:object_dict_list":[{"@version":"2.2","@xsi:type":"premis:file","ns1:objectCharacteristics_dict_list":[{"ns1:compositionLevel":"0","ns1:creatingApplication_dict_list":[{"ns1:dateCreatedByApplication":"2018-12-11"}],"ns1:size":"4261301","ns1:fixity_dict_list":[{"ns1:messageDigest":"91a5ddca3637590c2ddb50da5feb73ff0b8a98cd09a98afb79adc2cf70bc6220","ns1:messageDigestAlgorithm":"sha256"}],"ns1:format_dict_list":[{"ns1:formatDesignation_dict_list":[{"ns1:formatName":"Truevision
- TGA Bitmap","ns1:formatVersion":"2.0"}],"ns1:formatRegistry_dict_list":[{"ns1:formatRegistryKey":"fmt/402","ns1:formatRegistryName":"PRONOM"}]}],"ns1:objectCharacteristicsExtension":null}],"ns1:originalName":"%transferDirectory%objects/MARBLES.TGA","ns1:relationship_dict_list":[{"ns1:relatedObjectIdentification_dict_list":[{"ns1:relatedObjectIdentifierType":"UUID","ns1:relatedObjectIdentifierValue":"c8979006-38b4-4ac2-a630-6f8b6f4b9c37"}],"ns1:relationshipType":"derivation","ns1:relationshipSubType":"is
- source of","ns1:relatedEventIdentification_dict_list":[{"ns1:relatedEventIdentifierValue":"1317ed36-c367-4703-824f-6ae4c2c31340","ns1:relatedEventIdentifierType":"UUID"}]}],"ns1:objectIdentifier_dict_list":[{"ns1:objectIdentifierType":"UUID","ns1:objectIdentifierValue":"97e39f9d-1577-42cd-bc40-80b055747081"}],"@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"techMD_4"}],"@xmlns:ns1":"info:lc/xmlns/premis-v2","@xmlns:ns0":"http://www.loc.gov/METS/","@xmlns:xsi":"http://www.w3.org/2001/XMLSchema-instance","@ID":"amdSec_4","ns0:digiprovMD_dict_list":[{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":null}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"48868c6e-af8c-44c0-847a-1eba98bf78f8"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:34.787958+00:00","ns1:eventDetail":null,"ns1:eventType":"ingestion","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_20"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"91a5ddca3637590c2ddb50da5feb73ff0b8a98cd09a98afb79adc2cf70bc6220"}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"6d188185-d836-4f0d-9b9d-225b351c7dbe"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:35.165978+00:00","ns1:eventDetail":"program=\"python\";
- module=\"hashlib.sha256()\"","ns1:eventType":"message digest calculation","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_21"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":"Pass","ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":null}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"69882dce-8d4a-4ba6-b25c-c27ee6d938a3"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:39.502799+00:00","ns1:eventDetail":"program=\"ClamAV
- (clamd)\"; version=\"ClamAV 0.99.2\"; virusDefinitions=\"25255/Mon Dec 31
- 06:25:07 2018\"","ns1:eventType":"virus check","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_22"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":"Positive","ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"fmt/402"}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"9b3c3036-73b7-4db9-aaad-ea9ed785c0a4"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:30:43.547201+00:00","ns1:eventDetail":"program=\"Siegfried\";
- version=\"1.7.10\"","ns1:eventType":"format identification","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_23"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:EVENT","ns0:xmlData_dict_list":[{"ns1:event_dict_list":[{"ns1:eventOutcomeInformation_dict_list":[{"ns1:eventOutcome":null,"ns1:eventOutcomeDetail_dict_list":[{"ns1:eventOutcomeDetailNote":"%SIPDirectory%objects/MARBLES-c8979006-38b4-4ac2-a630-6f8b6f4b9c37.tif"}]}],"ns1:eventIdentifier_dict_list":[{"ns1:eventIdentifierType":"UUID","ns1:eventIdentifierValue":"1317ed36-c367-4703-824f-6ae4c2c31340"}],"ns1:linkingAgentIdentifier_dict_list":[{"ns1:linkingAgentIdentifierValue":"Archivematica-1.9","ns1:linkingAgentIdentifierType":"preservation
- system"},{"ns1:linkingAgentIdentifierValue":"test","ns1:linkingAgentIdentifierType":"repository
- code"}],"ns1:eventDateTime":"2018-12-31T14:31:00.171076+00:00","ns1:eventDetail":"ArchivematicaFPRCommandID=\"a34ddc9b-c922-4bb6-8037-bbe713332175\";
- program=\"convert\"; version=\"Version: ImageMagick 6.9.7-4 Q16 x86_64 20170114
- http://www.imagemagick.org\"","ns1:eventType":"normalization","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd"}]}]}],"@ID":"digiprovMD_24"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:AGENT","ns0:xmlData_dict_list":[{"ns1:agent_dict_list":[{"ns1:agentIdentifier_dict_list":[{"ns1:agentIdentifierType":"preservation
- system","ns1:agentIdentifierValue":"Archivematica-1.9"}],"ns1:agentType":"software","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd","ns1:agentName":"Archivematica"}]}]}],"@ID":"digiprovMD_25"},{"ns0:mdWrap_dict_list":[{"@MDTYPE":"PREMIS:AGENT","ns0:xmlData_dict_list":[{"ns1:agent_dict_list":[{"ns1:agentIdentifier_dict_list":[{"ns1:agentIdentifierType":"repository
- code","ns1:agentIdentifierValue":"test"}],"ns1:agentType":"organization","@version":"2.2","@xsi:schemaLocation":"info:lc/xmlns/premis-v2
- http://www.loc.gov/standards/premis/v2/premis-v2-2.xsd","ns1:agentName":"test"}]}]}],"@ID":"digiprovMD_26"}]}]}},"FILEUUID":"97e39f9d-1577-42cd-bc40-80b055747081","sipName":"20181231153024","filePath":"objects/MARBLES.TGA","indexedAt":1546273775.097954,"identifiers":[],"AIPUUID":"b34521a3-1c63-43dd-b901-584416f36c91","isPartOf":null,"archivematicaVersion":"1.9","fileExtension":"tga","transferMetadata":[],"AICID":null}}]}}'}
- headers:
- content-length: ['19387']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"query":{"term":{"AIPUUID":"b34521a3-1c63-43dd-b901-584416f36c91"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: POST
- uri: http://elasticsearch:9200/aipfiles/_delete_by_query
- response:
- body: {string: !!python/unicode '{"took":11,"timed_out":false,"total":2,"deleted":2,"batches":1,"version_conflicts":0,"noops":0,"retries":{"bulk":0,"search":0},"throttled_millis":0,"requests_per_second":-1.0,"throttled_until_millis":0,"failures":[]}'}
- headers:
- content-length: ['216']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"query":{"term":{"AIPUUID":"b34521a3-1c63-43dd-b901-584416f36c91"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/aipfiles/_search
- response:
- body: {string: !!python/unicode '{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
- headers:
- content-length: ['134']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/archivematicaCommon/tests/fixtures/test_elasticsearch_setup.yaml b/src/archivematicaCommon/tests/fixtures/test_elasticsearch_setup.yaml
deleted file mode 100644
index 6f55f24ff1..0000000000
--- a/src/archivematicaCommon/tests/fixtures/test_elasticsearch_setup.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-interactions:
-- request:
- body: null
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: HEAD
- uri: http://elasticsearch:9200/aips,aipfiles,transfers,transferfiles
- response:
- body: {string: !!python/unicode ''}
- headers:
- content-length: ['25355']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/archivematicaCommon/tests/fixtures/test_get_tags_no_matches.yaml b/src/archivematicaCommon/tests/fixtures/test_get_tags_no_matches.yaml
deleted file mode 100644
index 75b2cbceae..0000000000
--- a/src/archivematicaCommon/tests/fixtures/test_get_tags_no_matches.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-interactions:
-- request:
- body: !!python/unicode '{"query":{"term":{"fileuuid":"no_such_file"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/transferfiles/_search?_source=tags
- response:
- body: {string: !!python/unicode '{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
- headers:
- content-length: ['134']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/archivematicaCommon/tests/fixtures/test_set_get_tags.yaml b/src/archivematicaCommon/tests/fixtures/test_set_get_tags.yaml
deleted file mode 100644
index bb84c1fdfb..0000000000
--- a/src/archivematicaCommon/tests/fixtures/test_set_get_tags.yaml
+++ /dev/null
@@ -1,41 +0,0 @@
-interactions:
-- request:
- body: !!python/unicode '{"query":{"term":{"fileuuid":"268421a7-a986-4fa0-95c1-54176e508210"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/transferfiles/_search?size=10000
- response:
- body: {string: !!python/unicode '{"took":1,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":0.6931472,"hits":[{"_index":"transferfiles","_type":"_doc","_id":"mBsZBWgBn49OAVhMh-OV","_score":0.6931472,"_source":{"accessionid":"","status":"backlog","sipuuid":"17b168b6-cbba-4f43-8838-a53360238acb","tags":[],"file_extension":"jpg","relative_path":"test-17b168b6-cbba-4f43-8838-a53360238acb/objects/Landing_zone.jpg","bulk_extractor_reports":[],"origin":"1a14043f-68ef-4bfe-a129-e2e4cdbe391b","size":1.2982568740844727,"modification_date":"2018-12-11","created":1546273029.7313669,"format":[],"ingestdate":"2018-12-31","filename":"Landing_zone.jpg","fileuuid":"268421a7-a986-4fa0-95c1-54176e508210"}}]}}'}
- headers:
- content-length: ['725']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"doc":{"tags":["test"]}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: POST
- uri: http://elasticsearch:9200/transferfiles/_doc/mBsZBWgBn49OAVhMh-OV/_update
- response:
- body: {string: !!python/unicode '{"_index":"transferfiles","_type":"_doc","_id":"mBsZBWgBn49OAVhMh-OV","_version":2,"result":"updated","forced_refresh":true,"_shards":{"total":2,"successful":1,"failed":0},"_seq_no":2,"_primary_term":1}'}
- headers:
- content-length: ['202']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-- request:
- body: !!python/unicode '{"query":{"term":{"fileuuid":"268421a7-a986-4fa0-95c1-54176e508210"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/transferfiles/_search?_source=tags
- response:
- body: {string: !!python/unicode '{"took":2,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":1,"max_score":0.47000363,"hits":[{"_index":"transferfiles","_type":"_doc","_id":"mBsZBWgBn49OAVhMh-OV","_score":0.47000363,"_source":{"tags":["test"]}}]}}'}
- headers:
- content-length: ['258']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/archivematicaCommon/tests/fixtures/test_set_tags_no_matches.yaml b/src/archivematicaCommon/tests/fixtures/test_set_tags_no_matches.yaml
deleted file mode 100644
index 95a225a1fd..0000000000
--- a/src/archivematicaCommon/tests/fixtures/test_set_tags_no_matches.yaml
+++ /dev/null
@@ -1,15 +0,0 @@
-interactions:
-- request:
- body: !!python/unicode '{"query":{"term":{"fileuuid":"no_such_file"}}}'
- headers:
- connection: [keep-alive]
- content-type: [application/json]
- method: GET
- uri: http://elasticsearch:9200/transferfiles/_search?size=10000
- response:
- body: {string: !!python/unicode '{"took":0,"timed_out":false,"_shards":{"total":5,"successful":5,"skipped":0,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}'}
- headers:
- content-length: ['134']
- content-type: [application/json; charset=UTF-8]
- status: {code: 200, message: OK}
-version: 1
diff --git a/src/archivematicaCommon/tests/test_elasticsearch_functions.py b/src/archivematicaCommon/tests/test_elasticsearch_functions.py
index 037b509d6f..31c976a87c 100644
--- a/src/archivematicaCommon/tests/test_elasticsearch_functions.py
+++ b/src/archivematicaCommon/tests/test_elasticsearch_functions.py
@@ -6,7 +6,6 @@
import elasticSearchFunctions
import pytest
-import vcr
from lxml import etree
from main.models import Directory
from main.models import Identifier
@@ -16,17 +15,57 @@
class TestElasticSearchFunctions(unittest.TestCase):
- @vcr.use_cassette(
- os.path.join(THIS_DIR, "fixtures", "test_elasticsearch_setup.yaml")
- )
def setUp(self):
- elasticSearchFunctions.setup("elasticsearch:9200")
+ with mock.patch("elasticsearch.transport.Transport.perform_request"):
+ elasticSearchFunctions.setup("elasticsearch:9200")
self.client = elasticSearchFunctions.get_client()
self.aip_uuid = "b34521a3-1c63-43dd-b901-584416f36c91"
self.file_uuid = "268421a7-a986-4fa0-95c1-54176e508210"
- @vcr.use_cassette(os.path.join(THIS_DIR, "fixtures", "test_delete_aip.yaml"))
- def test_delete_aip(self):
+ @mock.patch(
+ "elasticsearch.transport.Transport.perform_request",
+ side_effect=[
+ {
+ "took": 2,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {
+ "total": 1,
+ "max_score": 0.2876821,
+ "hits": [
+ {
+ "_index": "aips",
+ "_type": "_doc",
+ "_id": "lBsZBWgBn49OAVhMXeO8",
+ "_score": 0.2876821,
+ "_source": {"uuid": "b34521a3-1c63-43dd-b901-584416f36c91"},
+ }
+ ],
+ },
+ },
+ {
+ "took": 8,
+ "timed_out": False,
+ "total": 1,
+ "deleted": 1,
+ "batches": 1,
+ "version_conflicts": 0,
+ "noops": 0,
+ "retries": {"bulk": 0, "search": 0},
+ "throttled_millis": 0,
+ "requests_per_second": -1.0,
+ "throttled_until_millis": 0,
+ "failures": [],
+ },
+ {
+ "took": 0,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {"total": 0, "max_score": None, "hits": []},
+ },
+ ],
+ )
+ def test_delete_aip(self, perform_request):
# Verify AIP exists
results = self.client.search(
index="aips",
@@ -45,8 +84,61 @@ def test_delete_aip(self):
)
assert results["hits"]["total"] == 0
- @vcr.use_cassette(os.path.join(THIS_DIR, "fixtures", "test_delete_aip_files.yaml"))
- def test_delete_aip_files(self):
+ @mock.patch(
+ "elasticsearch.transport.Transport.perform_request",
+ side_effect=[
+ {
+ "took": 1,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {
+ "total": 2,
+ "max_score": 0.2876821,
+ "hits": [
+ {
+ "_index": "aipfiles",
+ "_type": "_doc",
+ "_id": "lRsZBWgBn49OAVhMXuMC",
+ "_score": 0.2876821,
+ "_source": {
+ "origin": "1a14043f-68ef-4bfe-a129-e2e4cdbe391b"
+ },
+ },
+ {
+ "_index": "aipfiles",
+ "_type": "_doc",
+ "_id": "lhsZBWgBn49OAVhMXuMh",
+ "_score": 0.2876821,
+ "_source": {
+ "origin": "1a14043f-68ef-4bfe-a129-e2e4cdbe391b"
+ },
+ },
+ ],
+ },
+ },
+ {
+ "took": 11,
+ "timed_out": False,
+ "total": 2,
+ "deleted": 2,
+ "batches": 1,
+ "version_conflicts": 0,
+ "noops": 0,
+ "retries": {"bulk": 0, "search": 0},
+ "throttled_millis": 0,
+ "requests_per_second": -1.0,
+ "throttled_until_millis": 0,
+ "failures": [],
+ },
+ {
+ "took": 0,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {"total": 0, "max_score": None, "hits": []},
+ },
+ ],
+ )
+ def test_delete_aip_files(self, perform_request):
# Verify AIP files exist
results = self.client.search(
index="aipfiles", body={"query": {"term": {"AIPUUID": self.aip_uuid}}}
@@ -60,26 +152,183 @@ def test_delete_aip_files(self):
)
assert results["hits"]["total"] == 0
- @vcr.use_cassette(os.path.join(THIS_DIR, "fixtures", "test_set_get_tags.yaml"))
- def test_set_get_tags(self):
+ assert perform_request.mock_calls == [
+ mock.call(
+ "GET",
+ "/aipfiles/_search",
+ params={},
+ body={
+ "query": {
+ "term": {"AIPUUID": "b34521a3-1c63-43dd-b901-584416f36c91"}
+ }
+ },
+ ),
+ mock.call(
+ "POST",
+ "/aipfiles/_delete_by_query",
+ params={},
+ body={
+ "query": {
+ "term": {"AIPUUID": "b34521a3-1c63-43dd-b901-584416f36c91"}
+ }
+ },
+ ),
+ mock.call(
+ "GET",
+ "/aipfiles/_search",
+ params={},
+ body={
+ "query": {
+ "term": {"AIPUUID": "b34521a3-1c63-43dd-b901-584416f36c91"}
+ }
+ },
+ ),
+ ]
+
+ @mock.patch(
+ "elasticsearch.transport.Transport.perform_request",
+ side_effect=[
+ {
+ "took": 1,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {
+ "total": 1,
+ "max_score": 0.6931472,
+ "hits": [
+ {
+ "_index": "transferfiles",
+ "_type": "_doc",
+ "_id": "mBsZBWgBn49OAVhMh-OV",
+ "_score": 0.6931472,
+ "_source": {
+ "accessionid": "",
+ "status": "backlog",
+ "sipuuid": "17b168b6-cbba-4f43-8838-a53360238acb",
+ "tags": [],
+ "file_extension": "jpg",
+ "relative_path": "test-17b168b6-cbba-4f43-8838-a53360238acb/objects/Landing_zone.jpg",
+ "bulk_extractor_reports": [],
+ "origin": "1a14043f-68ef-4bfe-a129-e2e4cdbe391b",
+ "size": 1.2982568740844727,
+ "modification_date": "2018-12-11",
+ "created": 1546273029.7313669,
+ "format": [],
+ "ingestdate": "2018-12-31",
+ "filename": "Landing_zone.jpg",
+ "fileuuid": "268421a7-a986-4fa0-95c1-54176e508210",
+ },
+ }
+ ],
+ },
+ },
+ {
+ "_index": "transferfiles",
+ "_type": "_doc",
+ "_id": "mBsZBWgBn49OAVhMh-OV",
+ "_version": 2,
+ "result": "updated",
+ "forced_refresh": True,
+ "_shards": {"total": 2, "successful": 1, "failed": 0},
+ "_seq_no": 2,
+ "_primary_term": 1,
+ },
+ {
+ "took": 2,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {
+ "total": 1,
+ "max_score": 0.47000363,
+ "hits": [
+ {
+ "_index": "transferfiles",
+ "_type": "_doc",
+ "_id": "mBsZBWgBn49OAVhMh-OV",
+ "_score": 0.47000363,
+ "_source": {"tags": ["test"]},
+ }
+ ],
+ },
+ },
+ ],
+ )
+ def test_set_get_tags(self, perform_request):
elasticSearchFunctions.set_file_tags(self.client, self.file_uuid, ["test"])
assert elasticSearchFunctions.get_file_tags(self.client, self.file_uuid) == [
"test"
]
- @vcr.use_cassette(
- os.path.join(THIS_DIR, "fixtures", "test_get_tags_no_matches.yaml")
+ assert perform_request.mock_calls == [
+ mock.call(
+ "GET",
+ "/transferfiles/_search",
+ params={"size": "10000"},
+ body={
+ "query": {
+ "term": {"fileuuid": "268421a7-a986-4fa0-95c1-54176e508210"}
+ }
+ },
+ ),
+ mock.call(
+ "POST",
+ "/transferfiles/_doc/mBsZBWgBn49OAVhMh-OV/_update",
+ params={},
+ body={"doc": {"tags": ["test"]}},
+ ),
+ mock.call(
+ "GET",
+ "/transferfiles/_search",
+ params={"_source": b"tags"},
+ body={
+ "query": {
+ "term": {"fileuuid": "268421a7-a986-4fa0-95c1-54176e508210"}
+ }
+ },
+ ),
+ ]
+
+ @mock.patch(
+ "elasticsearch.transport.Transport.perform_request",
+ side_effect=[
+ {
+ "took": 1,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {"total": 0, "max_score": None, "hits": []},
+ }
+ ],
)
- def test_list_tags_fails_when_file_cant_be_found(self):
+ def test_list_tags_fails_when_file_cant_be_found(self, perform_request):
with pytest.raises(elasticSearchFunctions.EmptySearchResultError):
elasticSearchFunctions.get_file_tags(self.client, "no_such_file")
+ perform_request.assert_called_once_with(
+ "GET",
+ "/transferfiles/_search",
+ params={"_source": b"tags"},
+ body={"query": {"term": {"fileuuid": "no_such_file"}}},
+ )
- @vcr.use_cassette(
- os.path.join(THIS_DIR, "fixtures", "test_set_tags_no_matches.yaml")
+ @mock.patch(
+ "elasticsearch.transport.Transport.perform_request",
+ side_effect=[
+ {
+ "took": 0,
+ "timed_out": False,
+ "_shards": {"total": 5, "successful": 5, "skipped": 0, "failed": 0},
+ "hits": {"total": 0, "max_score": None, "hits": []},
+ }
+ ],
)
- def test_set_tags_fails_when_file_cant_be_found(self):
+ def test_set_tags_fails_when_file_cant_be_found(self, perform_request):
with pytest.raises(elasticSearchFunctions.EmptySearchResultError):
elasticSearchFunctions.set_file_tags(self.client, "no_such_file", [])
+ perform_request.assert_called_once_with(
+ "GET",
+ "/transferfiles/_search",
+ params={"size": "10000"},
+ body={"query": {"term": {"fileuuid": "no_such_file"}}},
+ )
@pytest.mark.django_db
@mock.patch("elasticSearchFunctions.get_dashboard_uuid")