api/modules: remove redundant localModules
This commit is contained in:
@@ -29,8 +29,7 @@ def test_list_modules(test_flake_with_core: FlakeForTest) -> None:
|
||||
base_path = test_flake_with_core.path
|
||||
modules_info = list_modules(str(base_path))
|
||||
|
||||
assert "localModules" in modules_info
|
||||
assert "modulesPerSource" in modules_info
|
||||
assert "modules" in modules_info
|
||||
|
||||
|
||||
@pytest.mark.impure
|
||||
|
||||
@@ -154,22 +154,19 @@ class ModuleInfo(TypedDict):
|
||||
roles: dict[str, None]
|
||||
|
||||
|
||||
class ModuleLists(TypedDict):
|
||||
modulesPerSource: dict[str, dict[str, ModuleInfo]]
|
||||
localModules: dict[str, ModuleInfo]
|
||||
class ModuleList(TypedDict):
|
||||
modules: dict[str, dict[str, ModuleInfo]]
|
||||
|
||||
|
||||
@API.register
|
||||
def list_modules(base_path: str) -> ModuleLists:
|
||||
def list_modules(base_path: str) -> ModuleList:
|
||||
"""
|
||||
Show information about a module
|
||||
"""
|
||||
flake = Flake(base_path)
|
||||
modules = flake.select(
|
||||
"clanInternals.inventoryClass.{?modulesPerSource,?localModules}"
|
||||
)
|
||||
modules = flake.select("clanInternals.inventoryClass.modulesPerSource")
|
||||
|
||||
return modules
|
||||
return ModuleList({"modules": modules})
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
@@ -208,7 +208,7 @@ def test_clan_create_api(
|
||||
|
||||
modules = list_modules(str(clan_dir_flake.path))
|
||||
assert (
|
||||
modules["modulesPerSource"]["clan-core"]["admin"]["manifest"]["name"]
|
||||
modules["modules"]["clan-core"]["admin"]["manifest"]["name"]
|
||||
== "clan-core/admin"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user