Finish up cache and fix tests.
Still TODO: Merge with ignore functionality.
This commit is contained in:
11 files changed
+263
-106
No files matched your search
@@ -32,13 +32,13 @@ class TestLinterFunctions(unittest.TestCase):
|
||||
linter = MigrationLinter(project_path)
|
||||
self.assertFalse(linter.has_errors)
|
||||
|
||||
linter.lint_migration('test_app', '0001')
|
||||
linter.lint_migration('test_app', '0001_create_table')
|
||||
self.assertFalse(linter.has_errors)
|
||||
|
||||
linter.lint_migration('test_app', '0002')
|
||||
linter.lint_migration('test_app', '0002_add_new_not_null_field')
|
||||
self.assertTrue(linter.has_errors)
|
||||
|
||||
linter.lint_migration('test_app', '0001')
|
||||
linter.lint_migration('test_app', '0001_create_table')
|
||||
self.assertTrue(linter.has_errors)
|
||||
|
||||
def test_linter_creation(self):
|
||||
@@ -49,24 +49,6 @@ class TestLinterFunctions(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
MigrationLinter(fixtures.NOT_DJANGO_GIT_PROJECT)
|
||||
|
||||
def test_split_migration_long_path(self):
|
||||
input_path = 'apps/the_app/migrations/0001_stuff.py'
|
||||
app, mig = MigrationLinter._split_migration_path(input_path)
|
||||
self.assertEqual(app, 'the_app')
|
||||
self.assertEqual(mig, '0001_stuff')
|
||||
|
||||
def test_split_migration_path(self):
|
||||
input_path = 'the_app/migrations/0001_stuff.py'
|
||||
app, mig = MigrationLinter._split_migration_path(input_path)
|
||||
self.assertEqual(app, 'the_app')
|
||||
self.assertEqual(mig, '0001_stuff')
|
||||
|
||||
def test_split_migration_full_path(self):
|
||||
input_path = '/home/user/djangostuff/apps/the_app/migrations/0001_stuff.py'
|
||||
app, mig = MigrationLinter._split_migration_path(input_path)
|
||||
self.assertEqual(app, 'the_app')
|
||||
self.assertEqual(mig, '0001_stuff')
|
||||
|
||||
def test_ignore_migration_include_apps(self):
|
||||
linter = MigrationLinter(
|
||||
fixtures.ADD_NOT_NULL_COLUMN_PROJECT,
|
||||
|
||||
@@ -16,7 +16,8 @@ import os
|
||||
import unittest
|
||||
|
||||
from tests import fixtures
|
||||
from django_migration_linter.utils import is_django_project, is_git_project, is_directory, find_project_settings_module, split_path
|
||||
from django_migration_linter.utils import is_django_project, is_git_project, is_directory, find_project_settings_module, \
|
||||
split_path, split_migration_path
|
||||
|
||||
|
||||
class UtilityFunctionTest(unittest.TestCase):
|
||||
@@ -70,3 +71,21 @@ class UtilityFunctionTest(unittest.TestCase):
|
||||
self.assertEqual(splitted[0], 'foo')
|
||||
self.assertEqual(splitted[1], 'bar')
|
||||
self.assertEqual(splitted[2], 'fuz.py')
|
||||
|
||||
def test_split_migration_long_path(self):
|
||||
input_path = 'apps/the_app/migrations/0001_stuff.py'
|
||||
app, mig = split_migration_path(input_path)
|
||||
self.assertEqual(app, 'the_app')
|
||||
self.assertEqual(mig, '0001_stuff')
|
||||
|
||||
def test_split_migration_path(self):
|
||||
input_path = 'the_app/migrations/0001_stuff.py'
|
||||
app, mig = split_migration_path(input_path)
|
||||
self.assertEqual(app, 'the_app')
|
||||
self.assertEqual(mig, '0001_stuff')
|
||||
|
||||
def test_split_migration_full_path(self):
|
||||
input_path = '/home/user/djangostuff/apps/the_app/migrations/0001_stuff.py'
|
||||
app, mig = split_migration_path(input_path)
|
||||
self.assertEqual(app, 'the_app')
|
||||
self.assertEqual(mig, '0001_stuff')
|
||||
Reference in new issue
Block a user