-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
90054b2
commit 3cf2340
Showing
3 changed files
with
34 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
import sys | ||
|
||
|
||
if (sys.version_info >= (3, 0)): | ||
if sys.version_info >= (3, 0): | ||
from django_test_migrations.contrib.unittest_case import MigratorTestCase | ||
|
||
class TestMigrations(MigratorTestCase): | ||
|
||
migrate_from = ('categories', '0004_auto_20200517_1832') | ||
migrate_to = ('categories', '0005_unique_category_slug') | ||
migrate_from = ("categories", "0004_auto_20200517_1832") | ||
migrate_to = ("categories", "0005_unique_category_slug") | ||
|
||
def prepare(self): | ||
Category = self.old_state.apps.get_model('categories', 'Category') | ||
Category.tree.create(slug='foo', lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug='foo', lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug='foo', lft=0, rght=0, tree_id=0, level=0) | ||
Category = self.old_state.apps.get_model("categories", "Category") | ||
Category.tree.create(slug="foo", lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug="foo", lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug="foo", lft=0, rght=0, tree_id=0, level=0) | ||
for i in range(1, 12): | ||
Category.tree.create(slug='bar', lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug='baz', lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug="bar", lft=0, rght=0, tree_id=0, level=0) | ||
Category.tree.create(slug="baz", lft=0, rght=0, tree_id=0, level=0) | ||
assert Category.tree.count() == 15 | ||
|
||
def test_unique_slug_migration(self): | ||
Category = self.new_state.apps.get_model('categories', 'Category') | ||
Category = self.new_state.apps.get_model("categories", "Category") | ||
|
||
self.assertListEqual( | ||
list(Category.tree.values_list('slug', flat=True)), | ||
list(Category.tree.values_list("slug", flat=True)), | ||
[ | ||
'foo', | ||
'foo_1', | ||
'foo_2', | ||
'bar', | ||
'bar_01', | ||
'bar_02', | ||
'bar_03', | ||
'bar_04', | ||
'bar_05', | ||
'bar_06', | ||
'bar_07', | ||
'bar_08', | ||
'bar_09', | ||
'bar_10', | ||
'baz', | ||
"foo", | ||
"foo_1", | ||
"foo_2", | ||
"bar", | ||
"bar_01", | ||
"bar_02", | ||
"bar_03", | ||
"bar_04", | ||
"bar_05", | ||
"bar_06", | ||
"bar_07", | ||
"bar_08", | ||
"bar_09", | ||
"bar_10", | ||
"baz", | ||
], | ||
) |
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
-r test.txt | ||
|
||
bump2version>=1.0.1 | ||
git-fame>=1.12.2 | ||
generate-changelog | ||
git-fame>=1.12.2 | ||
pre-commit |