Best Python code snippet using molecule_python
tests.py
Source:tests.py
...43 form = ItouLoginForm(data=form_data, request=RequestFactory().get("/"))44 self.assertFalse(form.is_valid())45 self.assertIn("FranceConnect", form.errors["__all__"][0])46class PrescriberLoginTest(InclusionConnectBaseTestCase):47 def test_login_options(self):48 url = reverse("login:prescriber")49 response = self.client.get(url)50 self.assertEqual(response.status_code, 200)51 self.assertContains(response, "S'identifier avec Inclusion Connect")52 self.assertContains(response, reverse("inclusion_connect:authorize"))53 self.assertContains(response, "Adresse e-mail")54 self.assertContains(response, "Mot de passe")55 def test_login_using_django(self):56 user = PrescriberFactory()57 url = reverse("login:prescriber")58 response = self.client.get(url)59 self.assertEqual(response.status_code, 200)60 form_data = {61 "login": user.email,62 "password": DEFAULT_PASSWORD,63 }64 response = self.client.post(url, data=form_data)65 self.assertRedirects(response, reverse("account_email_verification_sent"))66 def test_login_using_django_but_has_sso_provider(self):67 user = PrescriberFactory(identity_provider=users_enums.IdentityProvider.INCLUSION_CONNECT)68 url = reverse("login:prescriber")69 response = self.client.get(url)70 self.assertEqual(response.status_code, 200)71 form_data = {72 "login": user.email,73 "password": "a",74 }75 response = self.client.post(url, data=form_data)76 self.assertEqual(response.status_code, 200)77 self.assertContains(78 response, "Votre compte est relié à Inclusion Connect. Merci de vous connecter avec ce service."79 )80class SiaeStaffLoginTest(InclusionConnectBaseTestCase):81 def test_login_options(self):82 url = reverse("login:siae_staff")83 response = self.client.get(url)84 self.assertEqual(response.status_code, 200)85 self.assertContains(response, "S'identifier avec Inclusion Connect")86 self.assertContains(response, reverse("inclusion_connect:authorize"))87 self.assertContains(response, "Adresse e-mail")88 self.assertContains(response, "Mot de passe")89 def test_login_using_django(self):90 user = SiaeStaffFactory()91 url = reverse("login:siae_staff")92 response = self.client.get(url)93 self.assertEqual(response.status_code, 200)94 form_data = {95 "login": user.email,96 "password": DEFAULT_PASSWORD,97 }98 response = self.client.post(url, data=form_data)99 self.assertRedirects(response, reverse("account_email_verification_sent"))100 def test_login_using_django_but_has_sso_provider(self):101 user = SiaeStaffFactory(identity_provider=users_enums.IdentityProvider.INCLUSION_CONNECT)102 url = reverse("login:siae_staff")103 response = self.client.get(url)104 self.assertEqual(response.status_code, 200)105 form_data = {106 "login": user.email,107 "password": "a",108 }109 response = self.client.post(url, data=form_data)110 self.assertEqual(response.status_code, 200)111 self.assertContains(112 response, "Votre compte est relié à Inclusion Connect. Merci de vous connecter avec ce service."113 )114class LaborInspectorLoginTest(TestCase):115 def test_login_options(self):116 url = reverse("login:labor_inspector")117 response = self.client.get(url)118 self.assertEqual(response.status_code, 200)119 self.assertNotContains(response, "S'identifier avec Inclusion Connect")120 self.assertContains(response, "Adresse e-mail")121 self.assertContains(response, "Mot de passe")122 def test_login(self):123 user = LaborInspectorFactory()124 url = reverse("login:labor_inspector")125 response = self.client.get(url)126 self.assertEqual(response.status_code, 200)127 form_data = {128 "login": user.email,129 "password": DEFAULT_PASSWORD,...
test_services_login.py
Source:test_services_login.py
...8 self.portal = self.layer["portal"]9 self.portal_url = self.portal.absolute_url()10 self.api_session = RelativeSession(self.portal_url)11 self.api_session.headers.update({"Accept": "application/json"})12 def test_login_options(self):13 response = self.api_session.get("@login")14 self.assertEqual(200, response.status_code)15 data = response.json()16 self.assertIs(type(data), dict)17 self.assertIn("options", data)18 self.assertEqual(len(data["options"]), 1)19 option = data["options"][0]20 self.assertEqual(option["id"], "github")21 self.assertEqual(option["plugin"], "authomatic")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!