From 4420d64c454934a31a8fc9771421b5370840fa99 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Sun, 11 Jul 2021 16:11:57 +0200 Subject: [PATCH] Fix getting status for all apps --- src/spoc/__init__.py | 4 ++-- tests/test_spoc.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/spoc/__init__.py b/src/spoc/__init__.py index 38a634b..a1231f2 100644 --- a/src/spoc/__init__.py +++ b/src/spoc/__init__.py @@ -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) diff --git a/tests/test_spoc.py b/tests/test_spoc.py index 2aa6d0a..e815608 100644 --- a/tests/test_spoc.py +++ b/tests/test_spoc.py @@ -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):