added first translation test

This commit is contained in:
Benni Bärmann 2022-01-19 13:36:19 +01:00
parent 76abe007ec
commit b1b68ae68d
1 changed files with 4 additions and 0 deletions

View File

@ -4,6 +4,7 @@ from django.contrib.auth.models import User
from django.conf import settings from django.conf import settings
from django.http import HttpResponse from django.http import HttpResponse
from django.core import mail from django.core import mail
from django.utils import translation
from .forms import ITForm, WorkingForm, OfficeForm, DummyForm from .forms import ITForm, WorkingForm, OfficeForm, DummyForm
@ -13,9 +14,12 @@ class LoginTestCase(TestCase):
self.user = User.objects.create_user('vladimir', 'vladimir@reiherzehe.com', 'reiherzehe') self.user = User.objects.create_user('vladimir', 'vladimir@reiherzehe.com', 'reiherzehe')
self.client.login(username='vladimir', password='reiherzehe') self.client.login(username='vladimir', password='reiherzehe')
self.response = self.client.get('/') self.response = self.client.get('/')
with translation.override('en'):
self.response_en = self.client.get('/')
def testLogin(self): def testLogin(self):
self.assertContains(self.response, 'Du bist eingeloggt als vladimir@reiherzehe.com', status_code=200) self.assertContains(self.response, 'Du bist eingeloggt als vladimir@reiherzehe.com', status_code=200)
self.assertContains(self.response_en, 'You are logged in as vladimir@reiherzehe.com', status_code=200)
def testDebugWarning(self): def testDebugWarning(self):
with self.settings(DEBUG=True): with self.settings(DEBUG=True):