diff options
Diffstat (limited to 'archaeological_context_records/tests.py')
-rw-r--r-- | archaeological_context_records/tests.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/archaeological_context_records/tests.py b/archaeological_context_records/tests.py index 85011a7bf..c9171f828 100644 --- a/archaeological_context_records/tests.py +++ b/archaeological_context_records/tests.py @@ -22,6 +22,7 @@ import json from io import StringIO import locale +from django.apps import apps from django.conf import settings from django.contrib.auth.models import Permission from django.core.exceptions import ValidationError, ImproperlyConfigured @@ -68,6 +69,9 @@ from archaeological_operations.models import Operation from archaeological_operations.serializers import operation_serialization from archaeological_context_records import views, serializers +if settings.SELENIUM_TEST: + from selenium.webdriver.support.wait import WebDriverWait + class ImportContextRecordTest(ImportTest, TestCase): fixtures = CONTEXT_RECORD_TOWNS_FIXTURES @@ -436,7 +440,9 @@ class ContextRecordTest(ContextRecordInit, TestCase): def test_downstream_cache_update(self): cr = self.create_context_record()[0] - from archaeological_finds.models import Find, BaseFind, MaterialType + BaseFind = apps.get_model("archaeological_finds", "BaseFind") + Find = apps.get_model("archaeological_finds", "Find") + MaterialType = apps.get_model("archaeological_finds", "MaterialType") data = { "label": "Find me a reason", @@ -1406,7 +1412,7 @@ class SeleniumTestsContextRecords(SeleniumTests): "features": [geojsons[bf_label]["get_pts"] for bf_label in bf_labels_pts], } - self.WebDriverWait(self.selenium, self.waiting_time).until( + WebDriverWait(self.selenium, self.waiting_time).until( lambda driver: driver.find_element_by_xpath( '//dl[@class="col-12"]/dt[text()="Display geo items" or text()="Afficher les éléments"]' ) @@ -1466,6 +1472,8 @@ class SeleniumTestsContextRecords(SeleniumTests): self.assertMap(base, slug_pk) def test_geo_items(self): + if not settings.SELENIUM_TEST: + return geojsons = self.default_geojson() # from operation self.access_from_dropdown("operation") |