diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-08-31 16:54:34 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-09-01 12:36:46 +0200 |
commit | eaa5572d612e76ea8f55a27ddb7143d3a7385ab3 (patch) | |
tree | 9a54f7a6a31c45779c11c4458e0caf5d2a284a4c /archaeological_context_records/tests.py | |
parent | 46d9f7a8eb6df547ecdfb441ff60efdd34f13296 (diff) | |
download | Ishtar-eaa5572d612e76ea8f55a27ddb7143d3a7385ab3.tar.bz2 Ishtar-eaa5572d612e76ea8f55a27ddb7143d3a7385ab3.zip |
Tests: clean imports
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") |