summaryrefslogtreecommitdiff
path: root/ishtar_common/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r--ishtar_common/tests.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index cdf6ce330..335b20ff6 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -34,6 +34,7 @@ from django.test.client import Client
from django.test.simple import DjangoTestSuiteRunner
from ishtar_common import models
+from ishtar_common.utils import post_save_point
"""
from django.conf import settings
@@ -541,3 +542,30 @@ class IshtarBasicTest(TestCase):
def test_status(self):
response = self.client.get(reverse('status'))
self.assertEqual(response.status_code, 200)
+
+
+class GeomaticTest(TestCase):
+ def test_post_save_point(self):
+ class FakeGeomaticObject(object):
+ def __init__(self, x, y, z, spatial_reference_system, point=None,
+ point_2d=None):
+ self.x = x
+ self.y = y
+ self.z = z
+ self.spatial_reference_system = spatial_reference_system
+ self.point = point
+ self.point_2d = point_2d
+
+ def save(self, *args, **kwargs):
+ pass
+
+ srs = models.SpatialReferenceSystem.objects.create(
+ label='WGS84', txt_idx='wgs84', srid=4326
+ )
+ obj = FakeGeomaticObject(
+ x=2, y=3, z=4,
+ spatial_reference_system=srs)
+ self.assertIsNone(obj.point_2d)
+ post_save_point(None, instance=obj)
+ self.assertIsNotNone(obj.point_2d)
+ self.assertIsNotNone(obj.point)