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
4 changed files
with
78 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import unittest | ||
from django.test import TransactionTestCase | ||
from django.contrib.messages import get_messages | ||
|
||
|
||
@unittest.skipUnless( | ||
os.getenv('TEST_CHECK_UNAPPLIED_MIGRATIONS_MIDDLEWARE'), | ||
'CheckUnappliedMigrationsMiddleware testing not enabled') | ||
class TestCheckUnappliedMigrationsMiddleware(TransactionTestCase): | ||
@classmethod | ||
def setUpClass(cls): | ||
cls.unapplied_migration_message = ('You have 41 unapplied migration(s)' | ||
'. See <a href="https://kiwitcms.' | ||
'readthedocs.io/en/latest/installin' | ||
'g_docker.html#initial-configuratio' | ||
'n-of-running-container">documentat' | ||
'ion</a>') | ||
|
||
def test_unapplied_migrations(self): | ||
response = self.client.get('/') | ||
messages = list(get_messages(response.wsgi_request)) | ||
self.assertEqual(str(messages[0]), self.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