Add tests, bump version

pull/1760/head
Piero Toffanin 2025-10-06 16:57:15 -04:00
rodzic 4c0b3b83f3
commit bf24866cc8
4 zmienionych plików z 37 dodań i 5 usunięć

Wyświetl plik

@ -1083,7 +1083,10 @@ class Task(models.Model):
ept_dir = self.assets_path("entwine_pointcloud") ept_dir = self.assets_path("entwine_pointcloud")
try: try:
tmp_ept_path = tempfile.mkdtemp('ept', dir=settings.MEDIA_TMP) if not os.path.exists(settings.MEDIA_TMP):
os.makedirs(settings.MEDIA_TMP)
tmp_ept_path = tempfile.mkdtemp('_ept', dir=settings.MEDIA_TMP)
params = [entwine, "build", "--threads", str(threads), params = [entwine, "build", "--threads", str(threads),
"--tmp", quote(tmp_ept_path), "--tmp", quote(tmp_ept_path),
"-i", quote(point_cloud), "-i", quote(point_cloud),

Wyświetl plik

@ -408,6 +408,10 @@ class TestApiTask(BootTransactionTestCase):
# Can download raw assets # Can download raw assets
res = client.get("/api/projects/{}/tasks/{}/assets/odm_orthophoto/odm_orthophoto.tif".format(project.id, task.id)) res = client.get("/api/projects/{}/tasks/{}/assets/odm_orthophoto/odm_orthophoto.tif".format(project.id, task.id))
self.assertTrue(res.status_code == status.HTTP_200_OK)
# EPT dataset should be there/have been created
res = client.get("/api/projects/{}/tasks/{}/assets/entwine_pointcloud/ept.json".format(project.id, task.id))
self.assertTrue(res.status_code == status.HTTP_200_OK) self.assertTrue(res.status_code == status.HTTP_200_OK)
# Orthophoto bands field should be populated # Orthophoto bands field should be populated

Wyświetl plik

@ -1,5 +1,7 @@
import os import os
import time import time
import shutil
import subprocess
import io import io
import requests import requests
@ -64,14 +66,31 @@ class TestApiTask(BootTransactionTestCase):
self.assertEqual(task.status, status_codes.COMPLETED) self.assertEqual(task.status, status_codes.COMPLETED)
if not os.path.exists(settings.MEDIA_TMP):
os.mkdir(settings.MEDIA_TMP)
# EPT assets should be there
res = client.get("/api/projects/{}/tasks/{}/assets/entwine_pointcloud/ept.json".format(project.id, task.id))
self.assertEqual(res.status_code, status.HTTP_200_OK)
# Try removing it
shutil.rmtree(task.assets_path("entwine_pointcloud"))
res = client.get("/api/projects/{}/tasks/{}/assets/entwine_pointcloud/ept.json".format(project.id, task.id))
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
# Rebuild it
self.assertTrue(task.check_ept())
# EPT available again
res = client.get("/api/projects/{}/tasks/{}/assets/entwine_pointcloud/ept.json".format(project.id, task.id))
self.assertEqual(res.status_code, status.HTTP_200_OK)
# Download task assets # Download task assets
task_uuid = task.uuid task_uuid = task.uuid
res = client.get("/api/projects/{}/tasks/{}/download/all.zip".format(project.id, task.id)) res = client.get("/api/projects/{}/tasks/{}/download/all.zip".format(project.id, task.id))
self.assertEqual(res.status_code, status.HTTP_200_OK) self.assertEqual(res.status_code, status.HTTP_200_OK)
if not os.path.exists(settings.MEDIA_TMP):
os.mkdir(settings.MEDIA_TMP)
assets_path = os.path.join(settings.MEDIA_TMP, "all.zip") assets_path = os.path.join(settings.MEDIA_TMP, "all.zip")
with open(assets_path, 'wb') as f: with open(assets_path, 'wb') as f:
@ -318,3 +337,9 @@ class TestApiTask(BootTransactionTestCase):
self.assertTrue(valid_cogeo(file_import_task.assets_path(task.ASSETS_MAP["orthophoto.tif"]))) self.assertTrue(valid_cogeo(file_import_task.assets_path(task.ASSETS_MAP["orthophoto.tif"])))
self.assertTrue(valid_cogeo(file_import_task.assets_path(task.ASSETS_MAP["dsm.tif"]))) self.assertTrue(valid_cogeo(file_import_task.assets_path(task.ASSETS_MAP["dsm.tif"])))
self.assertTrue(valid_cogeo(file_import_task.assets_path(task.ASSETS_MAP["dtm.tif"]))) self.assertTrue(valid_cogeo(file_import_task.assets_path(task.ASSETS_MAP["dtm.tif"])))
def test_entwine_bin(self):
entwine = shutil.which("entwine")
self.assertTrue(entwine is not None)
self.assertEqual(subprocess.run([entwine, "--help"]).returncode, 0)

Wyświetl plik

@ -1,6 +1,6 @@
{ {
"name": "WebODM", "name": "WebODM",
"version": "2.9.2", "version": "2.9.3",
"description": "User-friendly, extendable application and API for processing aerial imagery.", "description": "User-friendly, extendable application and API for processing aerial imagery.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {