Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_deposit_private_read_metadata.py
# Copyright (C) 2017-2019 The Software Heritage developers | # Copyright (C) 2017-2020 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
from django.urls import reverse | from django.urls import reverse | ||||
from rest_framework import status | from rest_framework import status | ||||
from swh.deposit.api import __version__ | |||||
from swh.deposit.config import EDIT_SE_IRI, PRIVATE_GET_DEPOSIT_METADATA, SWH_PERSON | from swh.deposit.config import EDIT_SE_IRI, PRIVATE_GET_DEPOSIT_METADATA, SWH_PERSON | ||||
from swh.deposit.models import Deposit | from swh.deposit.models import Deposit | ||||
PRIVATE_GET_DEPOSIT_METADATA_NC = PRIVATE_GET_DEPOSIT_METADATA + "-nc" | PRIVATE_GET_DEPOSIT_METADATA_NC = PRIVATE_GET_DEPOSIT_METADATA + "-nc" | ||||
def private_get_raw_url_endpoints(collection, deposit): | def private_get_raw_url_endpoints(collection, deposit): | ||||
"""There are 2 endpoints to check (one with collection, one without)""" | """There are 2 endpoints to check (one with collection, one without)""" | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | for url in private_get_raw_url_endpoints(deposit_collection, deposit): | ||||
"metadata": {}, | "metadata": {}, | ||||
"provider_name": "", | "provider_name": "", | ||||
"provider_type": "deposit_client", | "provider_type": "deposit_client", | ||||
"provider_url": "https://hal-test.archives-ouvertes.fr/", | "provider_url": "https://hal-test.archives-ouvertes.fr/", | ||||
}, | }, | ||||
"tool": { | "tool": { | ||||
"configuration": {"sword_version": "2"}, | "configuration": {"sword_version": "2"}, | ||||
"name": "swh-deposit", | "name": "swh-deposit", | ||||
"version": "0.0.1", | "version": __version__, | ||||
}, | }, | ||||
}, | }, | ||||
"deposit": { | "deposit": { | ||||
"author": SWH_PERSON, | "author": SWH_PERSON, | ||||
"committer": SWH_PERSON, | "committer": SWH_PERSON, | ||||
"committer_date": { | "committer_date": { | ||||
"negative_utc": False, | "negative_utc": False, | ||||
"offset": 0, | "offset": 0, | ||||
▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | for url in private_get_raw_url_endpoints(deposit_collection, deposit): | ||||
"metadata": {}, | "metadata": {}, | ||||
"provider_name": "", | "provider_name": "", | ||||
"provider_type": "deposit_client", | "provider_type": "deposit_client", | ||||
"provider_url": "https://hal-test.archives-ouvertes.fr/", | "provider_url": "https://hal-test.archives-ouvertes.fr/", | ||||
}, | }, | ||||
"tool": { | "tool": { | ||||
"configuration": {"sword_version": "2"}, | "configuration": {"sword_version": "2"}, | ||||
"name": "swh-deposit", | "name": "swh-deposit", | ||||
"version": "0.0.1", | "version": __version__, | ||||
}, | }, | ||||
}, | }, | ||||
"deposit": { | "deposit": { | ||||
"author": SWH_PERSON, | "author": SWH_PERSON, | ||||
"committer": SWH_PERSON, | "committer": SWH_PERSON, | ||||
"committer_date": { | "committer_date": { | ||||
"negative_utc": False, | "negative_utc": False, | ||||
"offset": 0, | "offset": 0, | ||||
▲ Show 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | for url in private_get_raw_url_endpoints(deposit_collection, deposit): | ||||
"metadata": {}, | "metadata": {}, | ||||
"provider_name": "", | "provider_name": "", | ||||
"provider_type": "deposit_client", | "provider_type": "deposit_client", | ||||
"provider_url": "https://hal-test.archives-ouvertes.fr/", | "provider_url": "https://hal-test.archives-ouvertes.fr/", | ||||
}, | }, | ||||
"tool": { | "tool": { | ||||
"configuration": {"sword_version": "2"}, | "configuration": {"sword_version": "2"}, | ||||
"name": "swh-deposit", | "name": "swh-deposit", | ||||
"version": "0.0.1", | "version": __version__, | ||||
}, | }, | ||||
}, | }, | ||||
"deposit": { | "deposit": { | ||||
"author": SWH_PERSON, | "author": SWH_PERSON, | ||||
"committer": SWH_PERSON, | "committer": SWH_PERSON, | ||||
"committer_date": { | "committer_date": { | ||||
"negative_utc": False, | "negative_utc": False, | ||||
"offset": 120, | "offset": 120, | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | for url in private_get_raw_url_endpoints(deposit_collection, deposit): | ||||
"metadata": {}, | "metadata": {}, | ||||
"provider_name": "", | "provider_name": "", | ||||
"provider_type": "deposit_client", | "provider_type": "deposit_client", | ||||
"provider_url": "https://hal-test.archives-ouvertes.fr/", | "provider_url": "https://hal-test.archives-ouvertes.fr/", | ||||
}, | }, | ||||
"tool": { | "tool": { | ||||
"configuration": {"sword_version": "2"}, | "configuration": {"sword_version": "2"}, | ||||
"name": "swh-deposit", | "name": "swh-deposit", | ||||
"version": "0.0.1", | "version": __version__, | ||||
}, | }, | ||||
} | } | ||||
expected_deposit_info = { | expected_deposit_info = { | ||||
"author": SWH_PERSON, | "author": SWH_PERSON, | ||||
"committer": SWH_PERSON, | "committer": SWH_PERSON, | ||||
"committer_date": { | "committer_date": { | ||||
"negative_utc": False, | "negative_utc": False, | ||||
▲ Show 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | for url in private_get_raw_url_endpoints(deposit_collection, deposit): | ||||
"metadata": {}, | "metadata": {}, | ||||
"provider_name": "", | "provider_name": "", | ||||
"provider_type": "deposit_client", | "provider_type": "deposit_client", | ||||
"provider_url": "https://hal-test.archives-ouvertes.fr/", | "provider_url": "https://hal-test.archives-ouvertes.fr/", | ||||
}, | }, | ||||
"tool": { | "tool": { | ||||
"configuration": {"sword_version": "2"}, | "configuration": {"sword_version": "2"}, | ||||
"name": "swh-deposit", | "name": "swh-deposit", | ||||
"version": "0.0.1", | "version": __version__, | ||||
}, | }, | ||||
} | } | ||||
expected_deposit_info = { | expected_deposit_info = { | ||||
"author": SWH_PERSON, | "author": SWH_PERSON, | ||||
"committer": SWH_PERSON, | "committer": SWH_PERSON, | ||||
"committer_date": { | "committer_date": { | ||||
"negative_utc": False, | "negative_utc": False, | ||||
Show All 40 Lines |