test: fix installer test to avoid actually doing anything
this one was forcibly overwriting my current web.conf and upgrade.sh
This commit is contained in:
parent
47902b37bc
commit
f63028bf8e
|
@ -74,23 +74,15 @@ class TestInstallHandler(ConfigTestCase):
|
|||
'dburl': f'sqlite:///{self.tempdir}/poser.sqlite',
|
||||
}
|
||||
|
||||
orig_import = __import__
|
||||
mock_prompt = MagicMock()
|
||||
|
||||
def mock_import(name, globals=None, locals=None, fromlist=(), level=0):
|
||||
if name == 'prompt_toolkit':
|
||||
if fromlist == ('prompt',):
|
||||
return MagicMock(prompt=mock_prompt)
|
||||
return orig_import(name, globals, locals, fromlist, level)
|
||||
|
||||
with patch('builtins.__import__', side_effect=mock_import):
|
||||
with patch.object(handler, 'get_dbinfo', return_value=dbinfo):
|
||||
with patch.object(handler, 'get_dbinfo', return_value=dbinfo):
|
||||
with patch.object(handler, 'make_appdir') as make_appdir:
|
||||
with patch.object(handler, 'install_db_schema') as install_db_schema:
|
||||
|
||||
# nb. just for sanity/coverage
|
||||
install_db_schema.return_value = True
|
||||
self.assertFalse(hasattr(handler, 'schema_installed'))
|
||||
handler.do_install_steps()
|
||||
self.assertTrue(make_appdir.called)
|
||||
self.assertTrue(handler.schema_installed)
|
||||
install_db_schema.assert_called_once_with(dbinfo['dburl'])
|
||||
|
||||
|
|
Loading…
Reference in a new issue