diff options
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/tests.py | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 51da0d879..48f0749b9 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -2541,7 +2541,13 @@ class GeomaticTest(FindInit, TestCase): base_find.multi_polygon = None base_find.save() base_find = models.BaseFind.objects.get(pk=base_find.pk) - dic = {"centroid": (2.0, 43.0)} + dic = { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [2.0, 43.0] + } + } res = base_find.get_geo_items(get_polygons=True) self.assertEqual(dic, res) res = base_find.get_geo_items(get_polygons=False) @@ -2560,14 +2566,32 @@ class GeomaticTest(FindInit, TestCase): base_find.save() base_find = models.BaseFind.objects.get(pk=base_find.pk) - dictPoly = {"externalPolygon1": [(1.0,1.0), (5.0,1.0), (5.0,5.0), (1.0,5.0), (1.0,1.0)], - "internalPolygon1": [(2.0,2.0), (2.0,3.0), (3.0,3.0), (3.0,2.0), (2.0,2.0)], - "externalPolygon2": [(6.0,3.0), (9.0,2.0), (9.0,4.0), (6.0,3.0)]} - resPoly = base_find.get_geo_items(get_polygons=True) - self.assertEqual(dictPoly, resPoly) - dictCentroid = {"centroid": (3.86111, 3.02778)} - resCentroid = base_find.get_geo_items(get_polygons=False) - self.assertEqual(dictCentroid, resCentroid) + dict_poly = { + "type": "Feature", + "geometry": { + "type": "MultiPolygon", + "coordinates": [ + [ + [[1.0, 1.0], [5.0, 1.0], [5.0, 5.0], [1.0, 5.0], [1.0, 1.0]], + [[2.0, 2.0], [2.0, 3.0], [3.0, 3.0], [3.0, 2.0], [2.0, 2.0]], + ], + [ + [[6.0, 3.0], [9.0, 2.0], [9.0, 4.0], [6.0, 3.0]] + ] + ] + }, + } + res_poly = base_find.get_geo_items(get_polygons=True) + self.assertEqual(dict_poly, res_poly) + dict_centroid = { + "type": "Feature", + "geometry": { + "type": "Point", + "coordinates": [3.86111, 3.02778] + } + } + res_centroid = base_find.get_geo_items(get_polygons=False) + self.assertEqual(dict_centroid, res_centroid) class AutocompleteTest(AutocompleteTestBase, TestCase): fixtures = FIND_FIXTURES |