Fix test for use in django 1.7 and up.

This commit is contained in:
Mario Rosa 2015-07-22 11:17:27 -04:00
parent 8728b6f505
commit 21891a382e
1 changed files with 10 additions and 9 deletions

View File

@ -45,8 +45,6 @@ class Tests(TestCase):
# Add the test apps to INSTALLED_APPS. # Add the test apps to INSTALLED_APPS.
self.unique_id = str(uuid4()).replace("-", "") self.unique_id = str(uuid4()).replace("-", "")
self.test_apps = ["app%s%s" % (i, self.unique_id) for i in range(10)] self.test_apps = ["app%s%s" % (i, self.unique_id) for i in range(10)]
settings.INSTALLED_APPS = list(settings.INSTALLED_APPS)
settings.INSTALLED_APPS.extend(self.test_apps)
# Create the app directories with the test template. # Create the app directories with the test template.
for test_app in self.test_apps: for test_app in self.test_apps:
@ -90,6 +88,9 @@ class Tests(TestCase):
""" """
Ensure the test string appear in the rendered template. Ensure the test string appear in the rendered template.
""" """
with self.modify_settings(INSTALLED_APPS={
'prepend': self.test_apps
}):
html = get_template(self.unique_id).render(Context()) html = get_template(self.unique_id).render(Context())
previous = "" previous = ""
for test_string in ["project"] + self.test_apps: for test_string in ["project"] + self.test_apps: