From 77445a529c3313384db27e006178cb767a706015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20No=C3=A9?= Date: Fri, 26 Jul 2024 10:21:39 +0200 Subject: [PATCH] One more test for recent adjustments --- dashboard/tests/selenium/test_integration.py | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dashboard/tests/selenium/test_integration.py b/dashboard/tests/selenium/test_integration.py index 6bbc55c..e64afa0 100644 --- a/dashboard/tests/selenium/test_integration.py +++ b/dashboard/tests/selenium/test_integration.py @@ -104,7 +104,7 @@ def setUp(self): gbif_dataset_key="aaa7b334-ce0d-4e88-aaae-2e0c138d049f", ) - obs_1 = Observation.objects.create( + self.obs_1 = Observation.objects.create( gbif_id=1, occurrence_id="1", species=self.first_species, @@ -114,7 +114,7 @@ def setUp(self): source_dataset=self.first_dataset, location=Point(5.09513, 50.48941, srid=4326), ) - obs_2 = Observation.objects.create( + self.obs_2 = Observation.objects.create( gbif_id=2, occurrence_id="2", species=self.second_species, @@ -124,7 +124,7 @@ def setUp(self): source_dataset=self.second_dataset, location=Point(4.35978, 50.64728, srid=4326), ) - obs_3 = Observation.objects.create( + self.obs_3 = Observation.objects.create( gbif_id=3, occurrence_id="3", species=self.second_species, @@ -136,11 +136,11 @@ def setUp(self): ) # Obs 1 (and only obs_1) has been seen by the user - ObservationUnseen.objects.create(observation=obs_1, user=adminuser) - ObservationUnseen.objects.create(observation=obs_2, user=normal_user) - ObservationUnseen.objects.create(observation=obs_2, user=adminuser) - ObservationUnseen.objects.create(observation=obs_3, user=normal_user) - ObservationUnseen.objects.create(observation=obs_3, user=adminuser) + ObservationUnseen.objects.create(observation=self.obs_1, user=adminuser) + ObservationUnseen.objects.create(observation=self.obs_2, user=normal_user) + ObservationUnseen.objects.create(observation=self.obs_2, user=adminuser) + ObservationUnseen.objects.create(observation=self.obs_3, user=normal_user) + ObservationUnseen.objects.create(observation=self.obs_3, user=adminuser) alert = Alert.objects.create( name="Test alert", @@ -932,6 +932,11 @@ def test_complete_signup_scenario_successful(self): navbar = self.selenium.find_element(By.ID, "gbif-alert-main-navbar") navbar.find_element(By.LINK_TEXT, "peterpan") + # All the existing observations are considered as seen by this new user + existing_observations = Observation.objects.all() + for obs in existing_observations: + self.assertTrue(obs.already_seen_by(latest_created_user)) + def test_signup_too_common_password(self): User = get_user_model() number_users_before = User.objects.count()