From 25b55e4ac3b82e01018cba87560868c5d4b4c29b Mon Sep 17 00:00:00 2001
From: iamashwin99 <ashwin-kumar.karnad@mpsd.mpg.de>
Date: Fri, 25 Aug 2023 14:18:46 +0200
Subject: [PATCH] update tests

---
 tests/test_mpsd_software.py | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/tests/test_mpsd_software.py b/tests/test_mpsd_software.py
index 0a50331..c900b25 100644
--- a/tests/test_mpsd_software.py
+++ b/tests/test_mpsd_software.py
@@ -502,7 +502,26 @@ def create_fake_environment(tmp_path, mpsd_release, expected_toolchain_map=None)
 
 
 def test_environment_status(tmp_path):
-    """Test that the environment status is correct."""
+    """Test that the environment status is correct.
+
+    The status command has the following three usage:
+
+    - 1) If no mpsd_release, list available releases
+    - 2) If mpsd_release, list available toolchains
+    - 3) If mpsd_release and toolchain, list available packages
+
+    We need to test all the three cases.
+    """
+
+    # 1) If no mpsd_release, list available releases
+    list_of_release_in_empty_dir = mod.environment_status(None, tmp_path)
+    assert list_of_release_in_empty_dir == []
+    (tmp_path / "test_case1" / "dev-23a").mkdir(parents=True, exist_ok=True)
+    (tmp_path / "test_case1" / "fake_release").mkdir(parents=True, exist_ok=True)
+    list_of_release = mod.environment_status(None, tmp_path / "test_case1")
+    assert list_of_release == ["dev-23a"]
+
+    # 2) If mpsd_release, list available toolchains
     toolchain_map = mod.environment_status("fake-release", tmp_path)
     assert toolchain_map is None
     mpsd_release = "dev-23a"
@@ -513,6 +532,9 @@ def test_environment_status(tmp_path):
     for microarch in expected_toolchain_map.keys():
         assert set(toolchain_map[microarch]) == set(expected_toolchain_map[microarch])
 
+    # 3) If mpsd_release and toolchain, list available packages
+    # TODO this test has to be written after the MR from remove mcd is merged
+
 
 def test_initialise_environment(tmp_path):
     """Test that init_file is created as expected."""
-- 
GitLab