kopia lustrzana https://github.com/OpenDroneMap/WebODM
Fixed unit tests
rodzic
90b5a9ce91
commit
2bbcefa77a
|
@ -170,8 +170,6 @@ class TaskViewSet(viewsets.ViewSet):
|
||||||
except (ObjectDoesNotExist, ValidationError):
|
except (ObjectDoesNotExist, ValidationError):
|
||||||
raise exceptions.NotFound()
|
raise exceptions.NotFound()
|
||||||
|
|
||||||
# TODO: check at least two images are present
|
|
||||||
|
|
||||||
task.partial = False
|
task.partial = False
|
||||||
task.images_count = models.ImageUpload.objects.filter(task=task).count()
|
task.images_count = models.ImageUpload.objects.filter(task=task).count()
|
||||||
|
|
||||||
|
@ -286,20 +284,6 @@ class TaskNestedView(APIView):
|
||||||
return task
|
return task
|
||||||
|
|
||||||
|
|
||||||
# class TaskTiles(TaskNestedView):
|
|
||||||
# def get(self, request, pk=None, project_pk=None, tile_type="", z="", x="", y=""):
|
|
||||||
# """
|
|
||||||
# Get a tile image
|
|
||||||
# """
|
|
||||||
# task = self.get_and_check_task(request, pk)
|
|
||||||
# tile_path = task.get_tile_path(tile_type, z, x, y)
|
|
||||||
# if os.path.isfile(tile_path):
|
|
||||||
# tile = open(tile_path, "rb")
|
|
||||||
# return HttpResponse(FileWrapper(tile), content_type="image/png")
|
|
||||||
# else:
|
|
||||||
# raise exceptions.NotFound()
|
|
||||||
|
|
||||||
|
|
||||||
def download_file_response(request, filePath, content_disposition):
|
def download_file_response(request, filePath, content_disposition):
|
||||||
filename = os.path.basename(filePath)
|
filename = os.path.basename(filePath)
|
||||||
filesize = os.stat(filePath).st_size
|
filesize = os.stat(filePath).st_size
|
||||||
|
|
|
@ -359,7 +359,7 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
# Can access individual tiles
|
# Can access individual tiles
|
||||||
for tile_type in tile_types:
|
for tile_type in tile_types:
|
||||||
res = client.get("/api/projects/{}/tasks/{}/{}/tiles/17/32042/46185.png".format(project.id, task.id, tile_type))
|
res = client.get("/api/projects/{}/tasks/{}/{}/tiles/17/32042/46185.png".format(project.id, task.id, tile_type))
|
||||||
self.assertEqual(res.status_code == status.HTTP_200_OK)
|
self.assertEqual(res.status_code, status.HTTP_200_OK)
|
||||||
|
|
||||||
# Another user does not have access to the resources
|
# Another user does not have access to the resources
|
||||||
other_client = APIClient()
|
other_client = APIClient()
|
||||||
|
@ -368,13 +368,13 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
def accessResources(expectedStatus):
|
def accessResources(expectedStatus):
|
||||||
for tile_type in tile_types:
|
for tile_type in tile_types:
|
||||||
res = other_client.get("/api/projects/{}/tasks/{}/{}/tiles.json".format(project.id, task.id, tile_type))
|
res = other_client.get("/api/projects/{}/tasks/{}/{}/tiles.json".format(project.id, task.id, tile_type))
|
||||||
self.assertTrue(res.status_code == expectedStatus)
|
self.assertEqual(res.status_code, expectedStatus)
|
||||||
|
|
||||||
res = other_client.get("/api/projects/{}/tasks/{}/{}/tiles/16/16020/42443.png".format(project.id, task.id, tile_type))
|
res = other_client.get("/api/projects/{}/tasks/{}/{}/tiles/17/32042/46185.png".format(project.id, task.id, tile_type))
|
||||||
self.assertTrue(res.status_code == expectedStatus)
|
self.assertEqual(res.status_code, expectedStatus)
|
||||||
|
|
||||||
res = other_client.get("/api/projects/{}/tasks/{}/".format(project.id, task.id))
|
res = other_client.get("/api/projects/{}/tasks/{}/".format(project.id, task.id))
|
||||||
self.assertTrue(res.status_code == expectedStatus)
|
self.assertEqual(res.status_code, expectedStatus)
|
||||||
|
|
||||||
accessResources(status.HTTP_404_NOT_FOUND)
|
accessResources(status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
|
@ -576,11 +576,11 @@ class TestApiTask(BootTransactionTestCase):
|
||||||
|
|
||||||
# Can access only tiles of available assets
|
# Can access only tiles of available assets
|
||||||
res = client.get("/api/projects/{}/tasks/{}/dsm/tiles.json".format(project.id, task.id))
|
res = client.get("/api/projects/{}/tasks/{}/dsm/tiles.json".format(project.id, task.id))
|
||||||
self.assertTrue(res.status_code == status.HTTP_200_OK)
|
self.assertEqual(res.status_code, status.HTTP_200_OK)
|
||||||
res = client.get("/api/projects/{}/tasks/{}/dtm/tiles.json".format(project.id, task.id))
|
res = client.get("/api/projects/{}/tasks/{}/dtm/tiles.json".format(project.id, task.id))
|
||||||
self.assertTrue(res.status_code == status.HTTP_200_OK)
|
self.assertEqual(res.status_code, status.HTTP_200_OK)
|
||||||
res = client.get("/api/projects/{}/tasks/{}/orthophoto/tiles.json".format(project.id, task.id))
|
res = client.get("/api/projects/{}/tasks/{}/orthophoto/tiles.json".format(project.id, task.id))
|
||||||
self.assertTrue(res.status_code == status.HTTP_400_BAD_REQUEST)
|
self.assertEqual(res.status_code, status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
# Available assets should be missing orthophoto.tif type
|
# Available assets should be missing orthophoto.tif type
|
||||||
# but others such as textured_model.zip should be available
|
# but others such as textured_model.zip should be available
|
||||||
|
|
Ładowanie…
Reference in New Issue