tests/test_api.py: Use UUID

DSpace 6+ uses a UUID for item identifiers instead of an integer so
we need to adapt our tests accordingly. The Python UUID object must
be cast to a string to use it elsewhere in the code.
This commit is contained in:
Alan Orth 2020-03-02 11:10:41 +02:00
parent 5955868b9a
commit 60e6ea57b1
1 changed files with 3 additions and 3 deletions

View File

@ -22,11 +22,11 @@ def test_get_docs(client):
def test_get_item(client):
"""Test requesting a single item."""
response = client.simulate_get("/item/17")
response = client.simulate_get("/item/c3910974-c3a5-4053-9dce-104aa7bb1621")
response_doc = json.loads(response.text)
assert isinstance(response_doc["downloads"], int)
assert isinstance(response_doc["id"], int)
assert isinstance(response_doc["id"], str)
assert isinstance(response_doc["views"], int)
assert response.status_code == 200
@ -34,7 +34,7 @@ def test_get_item(client):
def test_get_missing_item(client):
"""Test requesting a single non-existing item."""
response = client.simulate_get("/item/1")
response = client.simulate_get("/item/c3910974-c3a5-4053-9dce-104aa7bb1620")
assert response.status_code == 404