Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functional test for migration loading
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
tests/functional/domain/20101213141516_test_migration_1.migration
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,11 @@ | ||
SQL_UP = """ | ||
some test command; | ||
another test command; | ||
yet one more test command; | ||
""" | ||
|
||
SQL_DOWN = """ | ||
yet one more test command; | ||
another test command; | ||
some test command; | ||
""" |
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,2 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 |
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,27 @@ | ||
#!/usr/bin/env python | ||
# encoding: utf-8 | ||
|
||
from os.path import abspath, dirname, join | ||
|
||
from db_migrate.domain.migrations import Migration | ||
|
||
test_path = abspath(dirname(__file__)) | ||
|
||
def test_migration_can_load_a_file_with_proper_data(): | ||
migration_file = '20101213141516_test_migration_1.migration' | ||
migration = Migration(join(test_path, migration_file)) | ||
migration.load() | ||
|
||
assert migration.version == "20101213141516" | ||
assert migration.title == "test_migration_1" | ||
|
||
assert len(migration.up_statements) == 3 | ||
assert migration.up_statements[0] == "some test command" | ||
assert migration.up_statements[1] == "another test command" | ||
assert migration.up_statements[2] == "yet one more test command" | ||
|
||
assert len(migration.down_statements) == 3 | ||
assert migration.down_statements[0] == "yet one more test command" | ||
assert migration.down_statements[1] == "another test command" | ||
assert migration.down_statements[2] == "some test command" | ||
|