Verified Commit bbb80fe5 authored by Sunil Mohan Adapa's avatar Sunil Mohan Adapa Committed by James Valleroy

tests: Fix backups API test cases to work under all conditions

Ensure that loaded module list is mocked instead of actually loading modules.
Signed-off-by: Sunil Mohan Adapa's avatarSunil Mohan Adapa <>
Reviewed-by: James Valleroy's avatarJames Valleroy <>
parent 0e231548
......@@ -111,8 +111,10 @@ class TestBackupProcesses(unittest.TestCase):
def test_restore_apps(mock_install):
def test_restore_apps(mock_install, modules):
"""Test that restore_handler is called."""
modules.return_value = [('a', MagicMock())]
restore_handler = MagicMock()
......@@ -129,7 +131,6 @@ class TestBackupProcesses(unittest.TestCase):
del apps[3][1].backup
modules.return_value = apps
returned_apps = api.get_all_apps_for_backup()
expected_apps = [
api.BackupApp('a', apps[0][1]),
......@@ -148,7 +149,6 @@ class TestBackupProcesses(unittest.TestCase):
modules.return_value = apps
app_names = ['config', 'names']
apps = api.get_apps_in_order(app_names)
assert apps[0].name == 'names'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment