summaryrefslogtreecommitdiff
path: root/archaeological_finds/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/tests.py')
-rw-r--r--archaeological_finds/tests.py42
1 files changed, 33 insertions, 9 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index 4e237673a..e06d5faa0 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -2523,7 +2523,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)
@@ -2542,14 +2548,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