fixed tests with multilanguage stuff
This commit is contained in:
parent
03640646be
commit
35d26276e1
|
|
@ -39,7 +39,7 @@ MIGRATION_MODULES = DisableMigrations()
|
|||
DATABASES = {
|
||||
"default": {
|
||||
"ENGINE": "django.db.backends.postgresql_psycopg2",
|
||||
"NAME": "vbv_lernwelt",
|
||||
"NAME": "vbv_lernwelt_test",
|
||||
"USER": os.environ.get("PG_USER", getpass.getuser()),
|
||||
"PASSWORD": os.environ.get("PG_PASSWORD"),
|
||||
"HOST": "localhost",
|
||||
|
|
@ -47,5 +47,6 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
# Your stuff...
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -3,7 +3,4 @@ from vbv_lernwelt.learnpath.tests.learningpath_factories import LearningPathFact
|
|||
|
||||
|
||||
def create_default_learning_path():
|
||||
|
||||
lp = LearningPath()
|
||||
lp.save()
|
||||
#lp = LearningPathFactory()
|
||||
lp = LearningPathFactory()
|
||||
|
|
|
|||
|
|
@ -4,5 +4,7 @@ from vbv_lernwelt.learnpath.models import LearningPath
|
|||
|
||||
|
||||
class LearningPathFactory(wagtail_factories.PageFactory):
|
||||
title = "Versicherungsvermittler/in"
|
||||
|
||||
class Meta:
|
||||
model = LearningPath
|
||||
|
|
|
|||
|
|
@ -1,16 +1,21 @@
|
|||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
import locale
|
||||
from wagtail.core.models import Locale
|
||||
|
||||
from vbv_lernwelt.learnpath.models import LearningPath
|
||||
from vbv_lernwelt.learnpath.tests.create_default_learning_path import create_default_learning_path
|
||||
from django.utils.translation import to_locale, get_language
|
||||
|
||||
|
||||
class TestCreateDefaultLearningPaths(TestCase):
|
||||
def test_create_learning_path(self):
|
||||
print(locale.getdefaultlocale())
|
||||
print(to_locale(get_language()))
|
||||
def setUp(self) -> None:
|
||||
create_locales_for_wagtail()
|
||||
|
||||
def test_create_learning_path(self):
|
||||
create_default_learning_path()
|
||||
qs = LearningPath.objects.filter(title="Versicherungsvermittler/in")
|
||||
self.assertTrue(qs.exists())
|
||||
|
||||
|
||||
def create_locales_for_wagtail():
|
||||
for language in settings.WAGTAIL_CONTENT_LANGUAGES:
|
||||
Locale.objects.create(language_code=language[0])
|
||||
|
|
|
|||
Loading…
Reference in New Issue