Пример #1
0
 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()
Пример #2
0
 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()
Пример #3
0
 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="******")
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 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)
Пример #7
0
 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)
Пример #8
0
 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()
Пример #9
0
 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()