Skip to content

Commit

Permalink
ajout test login with different cases #156
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliettejns committed Mar 11, 2024
1 parent 94248c7 commit 9d2473a
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion tests/test_selenium/test_user_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,37 @@ def test_register_same_adress(self):
self.assertEqual(
sorted([e.text.strip() for e in self.driver_find_elements_by_css_selector(".alert.alert-danger")]),
sorted(['Email already registered. (Did you mean to log in instead?)']),
"Creating a new account using an already used mail adress but with differents cases fails."
"Creating a new account using an already used mail adress but with different cases fails."
)

user = User.query.filter(
User.first_name == "john",
User.last_name == "doe",
User.email == "[email protected]",
User.confirmed.is_(False)
).first()
self.assertIsNotNone(user)

def test_connexion_with_different_cases(self):
self.driver_find_element_by_link_text('Register').click()
self.driver_find_element_by_id("first_name").send_keys("john")
self.driver_find_element_by_id("last_name").send_keys("doe")
self.driver_find_element_by_id("email").send_keys("[email protected]")
self.driver_find_element_by_id("password").send_keys(self.app.config['ADMIN_PASSWORD'] + "testcase01!")
self.driver_find_element_by_id("password2").send_keys(self.app.config['ADMIN_PASSWORD'] + "testcase01!")
self.driver_find_element_by_id("submit").click()
self.logout()

self.driver_find_element_by_link_text('Log In').click()
self.driver_find_element_by_id("email").send_keys("[email protected]")
self.driver_find_element_by_id("password").send_keys(self.app.config['ADMIN_PASSWORD'] + "testcase01!")
self.driver_find_element_by_id('submit').click()

self.assertEqual(
sorted([e.text.strip() for e in self.driver_find_elements_by_css_selector(".alert.alert-success")]),
sorted(['You are now logged in. Welcome back!']),
"Logging using different cases for the mail adress works."
)
class TestUserWithMail(TestBase):
AUTO_LOG_IN = False

Expand Down

0 comments on commit 9d2473a

Please sign in to comment.