Skip to content

Commit 4874e2c

Browse files
committed
test: Add test for expired file
1 parent 9250eb0 commit 4874e2c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/test_general.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import io
22
import json
33
import os
4+
import shutil
45
from unittest.mock import patch
56

67
import libcove.lib.common as cove_common
@@ -261,6 +262,17 @@ def test_explore_page_null_version(client):
261262
assert resp.status_code == 200
262263

263264

265+
@pytest.mark.django_db
266+
def test_explore_page_expired_file(client):
267+
data = SuppliedData.objects.create()
268+
data.original_file.save("test.json", ContentFile('{"releases":[{}]}'))
269+
data.current_app = "cove_ocds"
270+
shutil.rmtree(data.upload_dir())
271+
resp = client.get(data.get_absolute_url())
272+
assert resp.status_code == 404
273+
assert b"automatically deleted after" in resp.content
274+
275+
264276
@pytest.mark.django_db
265277
@pytest.mark.parametrize(
266278
"json_data",

0 commit comments

Comments
 (0)