forked from kiwitcms/Kiwi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refs kiwitcms#1696. Add middleware to warn for unapplied migrations
- Loading branch information
Showing
6 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import os | ||
import unittest | ||
from django import test | ||
from django.core.management import call_command | ||
|
||
|
||
@unittest.skipUnless( | ||
os.getenv('TEST_CHECK_UNAPPLIED_MIGRATIONS_MIDDLEWARE'), | ||
'CheckUnappliedMigrationsMiddleware testing not enabled') | ||
class TestCheckUnappliedMigrationsMiddleware(test.TransactionTestCase): | ||
def test_unapplied_migrations(self): | ||
call_command('migrate', 'bugs', 'zero', verbosity=2, interactive=False) | ||
unapplied_migration_message = 'unapplied migrations(s). See '\ | ||
'<a href="https://kiwitcms.readthedocs.io/en/latest/'\ | ||
'installing_docker.html#initial-configuration-of-running-'\ | ||
'container">documentation</a>' | ||
response = self.client.get('/', follow=True) | ||
self.assertContains(response, unapplied_migration_message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from tcms.settings.test import * # noqa: F401,F403 | ||
|
||
INSTALLED_APPS = [ | ||
'django.contrib.sites', | ||
'django.contrib.auth', | ||
'django.contrib.sessions', | ||
'django.contrib.contenttypes' | ||
] |