mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
add a test to make sure we don't have any more missing migrations
This commit is contained in:
parent
8da725bd18
commit
b453943f86
1 changed files with 27 additions and 0 deletions
27
axes/tests/test_models.py
Normal file
27
axes/tests/test_models.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
from django.test import TestCase
|
||||
|
||||
|
||||
class MigrationsCheck(TestCase):
|
||||
def setUp(self):
|
||||
from django.utils import translation
|
||||
self.saved_locale = translation.get_language()
|
||||
translation.deactivate_all()
|
||||
|
||||
def tearDown(self):
|
||||
if self.saved_locale is not None:
|
||||
from django.utils import translation
|
||||
translation.activate(self.saved_locale)
|
||||
|
||||
def test_missing_migrations(self):
|
||||
from django.db import connection
|
||||
from django.apps.registry import apps
|
||||
from django.db.migrations.executor import MigrationExecutor
|
||||
executor = MigrationExecutor(connection)
|
||||
from django.db.migrations.autodetector import MigrationAutodetector
|
||||
from django.db.migrations.state import ProjectState
|
||||
autodetector = MigrationAutodetector(
|
||||
executor.loader.project_state(),
|
||||
ProjectState.from_apps(apps),
|
||||
)
|
||||
changes = autodetector.changes(graph=executor.loader.graph)
|
||||
self.assertEqual({}, changes)
|
||||
Loading…
Reference in a new issue