Skip to content

Commit

Permalink
Lib: fix build_migration_plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Joachim Jablon committed Jul 24, 2020
1 parent 100f23a commit deb8c8c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion septentrion/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def is_schema_initialized(**settings_kwargs):

def build_migration_plan(**settings_kwargs):
lib_kwargs = initialize(settings_kwargs)
return core.build_migration_plan(settings=lib_kwargs["settings"])
schema_version = core.get_best_schema_version(settings=lib_kwargs["settings"])
return core.build_migration_plan(
settings=lib_kwargs["settings"], schema_version=schema_version
)


def fake(version: str, **settings_kwargs):
Expand Down
9 changes: 7 additions & 2 deletions tests/unit/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,16 @@ def test_is_schema_initialized(fake_db, mocker):


def test_build_migration_plan(fake_db, mocker):
mock = mocker.patch("septentrion.core.build_migration_plan", return_value="is it ?")
build_migration_plan = mocker.patch(
"septentrion.core.build_migration_plan", return_value="is it ?"
)
get_best_schema_version = mocker.patch("septentrion.core.get_best_schema_version")

assert lib.build_migration_plan() == "is it ?"

mock.assert_called_with(settings=mocker.ANY)
build_migration_plan.assert_called_with(
settings=mocker.ANY, schema_version=get_best_schema_version.return_value
)


def test_load_fixtures(fake_db, mocker):
Expand Down

0 comments on commit deb8c8c

Please sign in to comment.