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