API: add clanModules list and details test
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
---
|
---
|
||||||
description = "Efficient, deduplicating backup program with optional compression and secure encryption."
|
description = "Efficient, deduplicating backup program with optional compression and secure encryption."
|
||||||
categories = ["backup"]
|
categories = ["backup"]
|
||||||
---
|
---
|
||||||
Long explanations1
|
|
||||||
Long explanations2
|
|
||||||
Long explanations3
|
|
||||||
@@ -122,14 +122,6 @@ Note: The meta results from clan/meta.json and manual flake arguments. It may no
|
|||||||
)
|
)
|
||||||
show_parser.set_defaults(func=show.show_command)
|
show_parser.set_defaults(func=show.show_command)
|
||||||
|
|
||||||
modules_parser = subparsers.add_parser("modules", help="Show modules")
|
|
||||||
modules_parser.add_argument(
|
|
||||||
"module_name",
|
|
||||||
help="name of the module",
|
|
||||||
type=str,
|
|
||||||
)
|
|
||||||
modules_parser.set_defaults(func=modules.command)
|
|
||||||
|
|
||||||
parser_backups = subparsers.add_parser(
|
parser_backups = subparsers.add_parser(
|
||||||
"backups",
|
"backups",
|
||||||
help="manage backups of clan machines",
|
help="manage backups of clan machines",
|
||||||
|
|||||||
25
pkgs/clan-cli/tests/test_modules.py
Normal file
25
pkgs/clan-cli/tests/test_modules.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import pytest
|
||||||
|
from fixtures_flakes import FlakeForTest
|
||||||
|
|
||||||
|
from clan_cli.api.modules import list_modules, show_module_info
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.with_core
|
||||||
|
def test_list_modules(test_flake_with_core: FlakeForTest) -> None:
|
||||||
|
base_path = test_flake_with_core.path
|
||||||
|
module_list = list_modules(base_path)
|
||||||
|
assert isinstance(module_list, list)
|
||||||
|
assert len(module_list) > 1
|
||||||
|
# Random test for those two modules
|
||||||
|
assert "borgbackup" in module_list
|
||||||
|
assert "syncthing" in module_list
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.with_core
|
||||||
|
def test_modules_details(test_flake_with_core: FlakeForTest) -> None:
|
||||||
|
base_path = test_flake_with_core.path
|
||||||
|
test_module = "borgbackup"
|
||||||
|
module_info = show_module_info(base_path, test_module)
|
||||||
|
assert module_info.description is not None and module_info.description != ""
|
||||||
|
assert module_info.categories and "backup" in module_info.categories
|
||||||
|
assert module_info.roles == ["server", "client"]
|
||||||
Reference in New Issue
Block a user