diff --git a/tests/test_mpsd_software.py b/tests/test_mpsd_software.py index 0a503315a89740ec09b1d98dab7b272e5c25d27b..c900b258c6f18086cb9ebeb981843e212a3e20be 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."""