Use correct config key in alembic extension

While the value we're looking for is passed into the Extension as
'alembic_repo_path' it is actually stored in the alembic config as
'script_location'. This change fixes the call to the alembic config
and retrieves 'script_location' instead.

Change-Id: Ia328e8230d33dc063c0d377e04f15f1ccaa4d500
Closes-Bug: #1486655
This commit is contained in:
Andrew Melton 2015-08-19 09:57:46 -07:00
parent 4e83ad8299
commit 27b7301438
2 changed files with 5 additions and 1 deletions

View File

@ -95,7 +95,7 @@ class AlembicExtension(ext_base.MigrationExtensionBase):
if rev_id in ['base', 'head']:
return True
script = alembic_script.ScriptDirectory(
self.config.get_main_option('alembic_repo_path'))
self.config.get_main_option('script_location'))
try:
script.get_revision(rev_id)
return True

View File

@ -103,6 +103,8 @@ class TestAlembicExtension(test_base.BaseTestCase):
# since alembic_script is mocked and no exception is raised, call
# will result in success
self.assertIs(True, self.alembic.has_revision('test'))
self.alembic.config.get_main_option.assert_called_once_with(
'script_location')
mocked.ScriptDirectory().get_revision.assert_called_once_with(
'test')
self.assertIs(True, self.alembic.has_revision(None))
@ -116,6 +118,8 @@ class TestAlembicExtension(test_base.BaseTestCase):
self.alembic.config.get_main_option = mock.Mock()
# exception is raised, the call should be false
self.assertIs(False, self.alembic.has_revision('test'))
self.alembic.config.get_main_option.assert_called_once_with(
'script_location')
mocked.ScriptDirectory().get_revision.assert_called_once_with(
'test')