def test_with_user_login(self): self.client.login(username=self.ldap_user_1.username, password=get_password()) response = self.client.get(reverse('realm-detail', args=[self.realm_1.id])) self.assertContains(response, 'Leider hast du keine Rechte', status_code=403) self.client.logout()
def test_with_admin_login(self): self.client.login(username=self.ldap_user_realm_1_admin.username, password=get_password()) response = self.client.get(reverse('realm-detail', args=[self.realm_1.id])) self.assertContains(response, 'Bereich ', status_code=200) self.client.logout()
def setUp(self): self.create_ldap_objects() try: self.django_superuser = User.objects.create_superuser(username="******", password=get_password()) except IntegrityError: self.django_superuser = User.objects.get(username="******")
def test_with_admin_login_wrong_realm(self): self.client.login(username=self.ldap_user_realm_2_admin.username, password=get_password()) response = self.client.get(reverse('realm-user-update', args=[self.realm_1.id, self.ldap_user_1.dn, ])) self.assertContains(response, 'Leider hast du keine Rechte', status_code=403)
def test_with_super_user_login(self): self.client.login(username=self.django_superuser.username, password=get_password()) response = self.client.get(reverse('realm-user-update', args=[self.realm_1.id, self.ldap_user_1.dn, ])) self.assertContains(response, f'<h3>{self.ldap_user_1.username}</h3>', status_code=200)
def test_with_super_user_login(self): self.client.login(username=self.django_superuser.username, password=get_password()) response = self.client.get( reverse('realm-user-list', args=[self.realm_1.id])) self.assertContains(response, 'Nutzer', status_code=200)
def test_with_super_user_login(self): self.client.login(username=self.django_superuser.username, password=get_password()) response = self.client.get(reverse('realm-add')) self.assertContains(response, 'Neuen Bereich anlegen', status_code=200)
def test_with_user_login(self): self.client.login(username=self.ldap_user_1.username, password=get_password()) response = self.client.get(reverse('realm-home')) self.assertContains(response, 'Profil löschen', status_code=200) self.client.logout()
def test_with_superuser_login(self): self.client.login(username=self.django_superuser.username, password=get_password()) response = self.client.get(reverse('realm-home')) self.assertContains(response, 'Bereiche', status_code=200) self.client.logout()