fix version sort and add test

This commit is contained in:
long2ice
2020-07-29 10:21:43 +08:00
parent e1ffcb609b
commit 17ab0a1421
4 changed files with 125 additions and 83 deletions

View File

@@ -28,3 +28,24 @@ def test_migrate():
'ALTER TABLE "category" DROP COLUMN "name"',
'ALTER TABLE "user" DROP INDEX "uid_user_usernam_9987ab"',
]
def test_sort_all_version_files(mocker):
mocker.patch(
"os.listdir",
return_value=[
"1_datetime_update.json",
"11_datetime_update.json",
"10_datetime_update.json",
"2_datetime_update.json",
],
)
Migrate.migrate_location = "."
assert Migrate.get_all_version_files() == [
"1_datetime_update.json",
"2_datetime_update.json",
"10_datetime_update.json",
"11_datetime_update.json",
]