2013-06-21 09:51:17 +02:00
|
|
|
from django.test.client import Client
|
2013-10-31 09:43:19 +01:00
|
|
|
from django.test.utils import override_settings
|
2013-06-21 09:51:17 +02:00
|
|
|
|
2014-10-11 14:34:49 +02:00
|
|
|
from openslides.users.models import Group, User
|
2013-06-21 09:51:17 +02:00
|
|
|
from openslides.utils.test import TestCase
|
|
|
|
|
|
|
|
|
2013-10-31 09:43:19 +01:00
|
|
|
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.PBKDF2PasswordHasher',))
|
2013-06-21 09:51:17 +02:00
|
|
|
class TestUmlautUser(TestCase):
|
|
|
|
"""
|
|
|
|
Tests persons with umlauts in there name.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def setUp(self):
|
2014-10-11 14:34:49 +02:00
|
|
|
self.user = User.objects.create_user('äöü', 'äöü')
|
2013-06-21 09:51:17 +02:00
|
|
|
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):
|
2014-10-11 14:34:49 +02:00
|
|
|
response = self.client.get('/user/1/edit/')
|
2013-06-21 09:51:17 +02:00
|
|
|
self.assertEqual(response.status_code, 403)
|
|
|
|
|
|
|
|
self.user.groups.add(Group.objects.get(pk=4))
|
|
|
|
|
2014-10-11 14:34:49 +02:00
|
|
|
response = self.client.get('/user/1/edit/')
|
2013-06-21 09:51:17 +02:00
|
|
|
self.assertEqual(response.status_code, 200)
|