Fix getting status for all apps

This commit is contained in:
Disassembler 2021-07-11 16:11:57 +02:00
parent 05f4d7955b
commit 4420d64c45
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
2 changed files with 11 additions and 2 deletions

View File

@ -73,8 +73,8 @@ def stop(app_name):
raise AppNotInstalledError(app_name)
podman.stop_pod(app_name)
def status(app_name):
if app_name not in podman.get_apps():
def status(app_name=None):
if app_name is not None and app_name not in podman.get_apps():
raise AppNotInstalledError(app_name)
return podman.get_pod_status(app_name)

View File

@ -185,6 +185,15 @@ def test_status(get_pod_status, podman_get_apps):
get_pod_status.assert_called_once_with('someapp')
assert status == 'RESULT'
@patch('spoc.podman.get_apps')
@patch('spoc.podman.get_pod_status', return_value='RESULT')
def test_status_all(get_pod_status, podman_get_apps):
status = spoc.status()
podman_get_apps.assert_not_called()
get_pod_status.assert_called_once_with(None)
assert status == 'RESULT'
@patch('spoc.podman.get_apps', return_value={})
@patch('spoc.podman.get_pod_status')
def test_status_not_installed(get_pod_status, podman_get_apps):