3527b0a75b
* New user model (used Django's AbstractBaseUser) * Renamed the app to users * removed person api See #861 Fixed #576 #478
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
from django.test.client import Client
|
|
from django.test.utils import override_settings
|
|
|
|
from openslides.users.models import Group, User
|
|
from openslides.utils.test import TestCase
|
|
|
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.PBKDF2PasswordHasher',))
|
|
class TestUmlautUser(TestCase):
|
|
"""
|
|
Tests persons with umlauts in there name.
|
|
"""
|
|
|
|
def setUp(self):
|
|
self.user = User.objects.create_user('äöü', 'äöü')
|
|
self.client = Client()
|
|
self.client.login(username='äöü', password='äöü')
|
|
|
|
def test_login(self):
|
|
client = Client()
|
|
response = client.post('/login/', {'username': 'äöü',
|
|
'password': 'äöüß'})
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
response = client.post('/login/', {'username': 'äöü',
|
|
'password': 'äöü'})
|
|
self.assertEqual(response.status_code, 302)
|
|
|
|
def test_logout(self):
|
|
response = self.client.get('/logout/')
|
|
self.assertEqual(response.status_code, 302)
|
|
|
|
def test_permission(self):
|
|
response = self.client.get('/user/1/edit/')
|
|
self.assertEqual(response.status_code, 403)
|
|
|
|
self.user.groups.add(Group.objects.get(pk=4))
|
|
|
|
response = self.client.get('/user/1/edit/')
|
|
self.assertEqual(response.status_code, 200)
|