Skip to content

Commit

Permalink
Functional test for migration loading
Browse files Browse the repository at this point in the history
  • Loading branch information
heynemann committed Aug 6, 2010
1 parent cf10adf commit a93c9b8
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/functional/domain/20101213141516_test_migration_1.migration
@@ -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;
"""
2 changes: 2 additions & 0 deletions tests/functional/domain/__init__.py
@@ -0,0 +1,2 @@
#!/usr/bin/env python
# encoding: utf-8
27 changes: 27 additions & 0 deletions tests/functional/domain/test_migration.py
@@ -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"

0 comments on commit a93c9b8

Please sign in to comment.