Skip to content

Commit 88e5490

Browse files
committed
update tests
1 parent 85a5834 commit 88e5490

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/mergin/tests/test_public_api_v2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#
33
# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial
44

5+
from mergin.sync.tasks import remove_unused_chunks
56
from . import DEFAULT_USER
67
from .utils import (
78
add_user,
@@ -22,6 +23,7 @@
2223

2324
from mergin.app import db
2425
from mergin.config import Configuration
26+
from mergin.sync.config import Configuration as SyncConfiguration
2527
from mergin.sync.errors import (
2628
BigChunkError,
2729
ProjectLocked,
@@ -375,10 +377,15 @@ def test_create_version(client, data, expected, err_code):
375377

376378
response = client.post(f"v2/projects/{project.id}/versions", json=data)
377379
assert response.status_code == expected
380+
# mock chunks expiration to check if removed
378381
if expected == 201:
379382
assert response.json["version"] == "v2"
380383
assert project.latest_version == 2
384+
# chunks exists after upload, cleanup job did not remove them
381385
assert all(os.path.exists(chunk) for chunk in chunks)
386+
with patch.object(SyncConfiguration, "UPLOAD_CHUNKS_EXPIRATION", 0):
387+
remove_unused_chunks()
388+
assert all(not os.path.exists(chunk) for chunk in chunks)
382389
else:
383390
assert project.latest_version == 1
384391
if err_code:

0 commit comments

Comments
 (0)