diff options
author | QuentinAndre <quentin.andre@imt-atlantique.net> | 2021-08-13 22:32:55 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-07-08 09:58:48 +0200 |
commit | 0c57d77eb424de082a576ff679d4ed342a61c01f (patch) | |
tree | 82a8e0b89e472b129ab40f031fc0386753e95ac5 /ishtar_common/tests.py | |
parent | 313aefcf470df2fe3ad660e568aa8cac308dfcae (diff) | |
download | Ishtar-0c57d77eb424de082a576ff679d4ed342a61c01f.tar.bz2 Ishtar-0c57d77eb424de082a576ff679d4ed342a61c01f.zip |
version before checkbutton
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 65 |
1 files changed, 28 insertions, 37 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index ac78cad02..9ed7394ea 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -47,7 +47,7 @@ from django.core.urlresolvers import reverse from django.db.models.fields import BooleanField from django.db.models.fields.related import ForeignKey from django.template.defaultfilters import slugify -from django.test import TestCase as BaseTestCase +from django.test import tag, TestCase as BaseTestCase from django.test.client import Client from django.test.runner import DiscoverRunner @@ -3212,6 +3212,7 @@ class TemplateGenerationTest(TestCase): from django.contrib.staticfiles.testing import StaticLiveServerTestCase from selenium.webdriver.firefox.webdriver import WebDriver +@tag("ui") class SeleniumTests(StaticLiveServerTestCase): from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.common.by import By @@ -3251,46 +3252,36 @@ class SeleniumTests(StaticLiveServerTestCase): self.selenium.find_element_by_xpath('//button[@type="submit"][@class="btn btn-primary"]').click() def setUpDefaultGeoItems(self): - from django.contrib.gis.geos import GEOSGeometry - from ishtar_common.models_common import SpatialReferenceSystem - from archaeological_finds.tests import GeomaticTest from archaeological_operations.tests import create_operation + from archaeological_finds.tests import GeomaticTest as GeomaticFindsTest ope1 = create_operation(self.user) ope2 = create_operation(self.user) + GeomaticFindsTest.create_cr_with_bfs(ope1, "Point", "Point", ["Polygon", "Point"], "CR Pt Poly Pt") + GeomaticFindsTest.create_cr_with_bfs(ope1, "Point", "Polygon", ["Polygon", "Point"], "CR Poly Poly Pt") + GeomaticFindsTest.create_cr_with_bfs(ope2, "Polygon", "Point", ["Polygon", "Point"], "CR Pt Poly Pt") + GeomaticFindsTest.create_cr_with_bfs(ope2, "Polygon", "Polygon", ["Polygon", "Point"], "CR Poly Poly Pt") + + geom_ope = [ + [[[[1, 1], [5, 1], [5, 5], [1, 5], [1, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]], + [[[6, 3], [9, 2], [9, 4], [6, 3]]]], + [3.86111, 3.02778], + [3.8, 3] + ] + geom_cr = [ + [[[[2, 1], [5, 1], [5, 5], [1, 5], [2, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]], + [[[6, 3], [9, 2], [9, 4], [6, 3]]]], + [3.86111, 3.02778], #TODO: change it + [3.9, 3] + ] + geom_bf = [ + [[[[2, 1], [4, 1], [4, 4], [1, 4], [2, 1]], [[2, 2], [2, 3], [3, 3], [3, 2], [2, 2]]], + [[[6, 3], [9, 2], [9, 4], [6, 3]]]], + [4.42105, 2.73684], + [3.9, 2.9] + ] + return [geom_ope, geom_cr, geom_bf] - wgs84 = SpatialReferenceSystem.objects.get(srid=4326) - limit = ( - "MULTIPOLYGON(((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))," - "((6 3,9 2,9 4,6 3)))" - ) - geom = GEOSGeometry("POINT({} {} {})".format(2, 43, 1), srid=4326) - geom_2d = GEOSGeometry("POINT({} {})".format(2, 43), srid=4326) - xy = 2, 43 - geom_params = [limit, geom, geom_2d, xy, wgs84] - - ope1 = self.Operation.objects.get(pk=ope1.pk) - ope1.multi_polygon = limit - ope1.save() - ope1 = self.Operation.objects.get(pk=ope1.pk) - ope1.point = geom - ope1.x, ope2.y = xy - ope1.point_source = "P" - ope1.spatial_reference_system = wgs84 - ope1.point_source_item = "Operation" - ope1.save() - ope1 = self.Operation.objects.get(pk=ope1.pk) - ope2.multi_polygon = limit - ope2.save() - - cr_pt1, (bf_poly_pt1, bf_pt_pt1) = GeomaticTest.create_cr_with_bfs(ope1, "Point", ["Polygon", "Point"], - "CR Pt Poly Pt", geom_params) - cr_poly1, (bf_poly_poly1, bf_pt_poly1) = GeomaticTest.create_cr_with_bfs(ope1, "Polygon", ["Polygon", "Point"], - "CR Poly Poly Pt", geom_params) - cr_pt2, (bf_poly_pt2, bf_pt_pt2) = GeomaticTest.create_cr_with_bfs(ope2, "Point", ["Polygon", "Point"], - "CR Pt Poly Pt", geom_params) - cr_poly2, (bf_poly_poly2, bf_pt_poly2) = GeomaticTest.create_cr_with_bfs(ope2, "Polygon", ["Polygon", "Point"], - "CR Poly Poly Pt", geom_params) def scroll(self, element): self.selenium.execute_script( "var viewPortHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);" @@ -3309,7 +3300,7 @@ class SeleniumTests(StaticLiveServerTestCase): ) print(id) print(self.selenium.execute_script('return print(arguments[0])', mapid)) - base_features, geo_items_feats = self.selenium.execute_script('return get_map_by_id(arguments[0])', mapid) + base_features, geo_items_feats = self.selenium.execute_script('return get_features_by_id(arguments[0])', mapid) base_features['features'][0]['properties'].pop('name') dic_base['features'][0]['properties']['id'] = id print('feat : ', base_features) |