mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
daemon: When ensuring running state handle not-installed state
Tests: - Uninstall miniflux and postgresql. Install freshly with all the patches in this series. When installing miniflux freshly, postgresql is not disabled soon after miniflux package is installed. Without this patch, postgresql is disabled after packages are installed leading to a setup failure. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
4ed2a25a8b
commit
f9ca06dc5f
2 files changed
+18
-2
No files matched your search
@@ -145,12 +145,21 @@ def test_is_running(service_is_running, daemon):
|
||||
|
||||
@patch('plinth.app.apps_init')
|
||||
@patch('plinth.action_utils.service_is_running')
|
||||
@patch('plinth.action_utils.service_show')
|
||||
@patch('subprocess.run')
|
||||
def test_ensure_running(subprocess_run, service_is_running, apps_init,
|
||||
app_list, mock_privileged, daemon):
|
||||
def test_ensure_running(subprocess_run, service_show, service_is_running,
|
||||
apps_init, app_list, mock_privileged, daemon):
|
||||
"""Test that checking that the daemon is running works."""
|
||||
common_args = dict(stdout=subprocess.PIPE, stderr=subprocess.PIPE,
|
||||
check=False)
|
||||
|
||||
service_show.return_value = {'LoadState': 'not-found'}
|
||||
with daemon.ensure_running() as starting_state:
|
||||
assert not starting_state
|
||||
assert subprocess_run.mock_calls == []
|
||||
|
||||
service_show.return_value = {'LoadState': 'loaded'}
|
||||
|
||||
service_is_running.return_value = True
|
||||
with daemon.ensure_running() as starting_state:
|
||||
assert starting_state
|
||||
|
||||
Reference in new issue
Block a user