diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-03 16:54:23 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2019-07-03 16:54:23 +0200 |
commit | 7aa9dae5d9ac5824aabc403391643312cc2434ae (patch) | |
tree | 37c28324679c91c467de949e39b54c0f381eef8c | |
parent | 77249701af2ba19f54bc117c90dd11f0531584d6 (diff) | |
download | Ishtar-7aa9dae5d9ac5824aabc403391643312cc2434ae.tar.bz2 Ishtar-7aa9dae5d9ac5824aabc403391643312cc2434ae.zip |
Geo: test point precision
-rw-r--r-- | archaeological_finds/tests.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py index 3d4d6f1d7..6426cf38b 100644 --- a/archaeological_finds/tests.py +++ b/archaeological_finds/tests.py @@ -1672,6 +1672,37 @@ class GeomaticTest(FindInit, TestCase): def setUp(self): self.create_finds(data_base={"label": u"Find 1"}, force=True) + def test_point_precision(self): + self.username = 'myuser' + self.password = 'mypassword' + User.objects.create_superuser(self.username, 'myemail@test.com', + self.password) + profile, created = IshtarSiteProfile.objects.get_or_create( + slug='default', active=True) + profile.mapping = True + profile.save() + wgs84 = SpatialReferenceSystem.objects.get(srid=4326) + find = self.finds[0] + base_find = find.base_finds.all()[0] + self.assertEqual(base_find.x, None) + + base_find.x, base_find.y = 33.12999, 42.78945 + base_find.spatial_reference_system = wgs84 + base_find.save() + + find = base_find.find.all()[0] + c = Client() + c.login(username=self.username, password=self.password) + response = c.get( + reverse('show-find', kwargs={'pk': find.pk})) + self.assertIn(b'33.12999', response.content) + profile.point_precision = 2 + profile.save() + + response = c.get( + reverse('show-find', kwargs={'pk': find.pk})) + self.assertIn(b'33.13', response.content) + def test_update_container_localisation_on_warehouse_update(self): profile, created = IshtarSiteProfile.objects.get_or_create( slug='default', active=True) |