Changeset View
Changeset View
Standalone View
Standalone View
swh/deposit/tests/api/test_collection.py
Show All 9 Lines | |||||
from rest_framework import status | from rest_framework import status | ||||
from swh.deposit.config import ( | from swh.deposit.config import ( | ||||
COL_IRI, | COL_IRI, | ||||
DEPOSIT_STATUS_LOAD_FAILURE, | DEPOSIT_STATUS_LOAD_FAILURE, | ||||
DEPOSIT_STATUS_LOAD_SUCCESS, | DEPOSIT_STATUS_LOAD_SUCCESS, | ||||
DEPOSIT_STATUS_PARTIAL, | DEPOSIT_STATUS_PARTIAL, | ||||
DEPOSIT_STATUS_REJECTED, | DEPOSIT_STATUS_REJECTED, | ||||
EDIT_SE_IRI, | SE_IRI, | ||||
) | ) | ||||
from swh.deposit.models import Deposit | from swh.deposit.models import Deposit | ||||
from swh.deposit.parsers import parse_xml | from swh.deposit.parsers import parse_xml | ||||
def test_deposit_post_will_fail_with_401(client): | def test_deposit_post_will_fail_with_401(client): | ||||
"""Without authentication, endpoint refuses access with 401 response | """Without authentication, endpoint refuses access with 401 response | ||||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
def test_act_on_deposit_rejected_is_not_permitted( | def test_act_on_deposit_rejected_is_not_permitted( | ||||
authenticated_client, deposit_collection, rejected_deposit, atom_dataset | authenticated_client, deposit_collection, rejected_deposit, atom_dataset | ||||
): | ): | ||||
deposit = rejected_deposit | deposit = rejected_deposit | ||||
response = authenticated_client.post( | response = authenticated_client.post( | ||||
reverse(EDIT_SE_IRI, args=[deposit.collection.name, deposit.id]), | reverse(SE_IRI, args=[deposit.collection.name, deposit.id]), | ||||
content_type="application/atom+xml;type=entry", | content_type="application/atom+xml;type=entry", | ||||
data=atom_dataset["entry-data1"], | data=atom_dataset["entry-data1"], | ||||
HTTP_SLUG=deposit.external_id, | HTTP_SLUG=deposit.external_id, | ||||
) | ) | ||||
assert response.status_code == status.HTTP_400_BAD_REQUEST | assert response.status_code == status.HTTP_400_BAD_REQUEST | ||||
msg = "You can only act on deposit with status '%s'" % ( | msg = "You can only act on deposit with status '%s'" % ( | ||||
DEPOSIT_STATUS_PARTIAL, | DEPOSIT_STATUS_PARTIAL, | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |