tests: generalize secret cli parser to work for all cli commands
This commit is contained in:
@@ -1,21 +1,14 @@
|
||||
import argparse
|
||||
from typing import Union
|
||||
|
||||
import pytest_subprocess.fake_process
|
||||
from cli import Cli
|
||||
from pytest_subprocess import utils
|
||||
|
||||
from clan_cli import admin
|
||||
|
||||
|
||||
def test_make_parser() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
admin.register_parser(parser)
|
||||
|
||||
|
||||
# using fp fixture from pytest-subprocess
|
||||
def test_create(fp: pytest_subprocess.fake_process.FakeProcess) -> None:
|
||||
cmd: list[Union[str, utils.Any]] = ["nix", "flake", "init", "-t", fp.any()]
|
||||
fp.register(cmd)
|
||||
args = argparse.Namespace(folder="./my-clan")
|
||||
admin.create(args)
|
||||
cli = Cli()
|
||||
cli.run(["admin", "--folder", "./my-clan", "create"])
|
||||
assert fp.call_count(cmd) == 1
|
||||
|
||||
Reference in New Issue
Block a user