moulinette_cli fixture

This commit is contained in:
Kay0u 2020-01-02 12:33:10 +08:00
parent 9315cab495
commit 535f4bcb3b
No known key found for this signature in database
GPG key ID: 7FF262C033518333

View file

@ -127,6 +127,24 @@ def moulinette_webapi(moulinette):
return TestApp(moulinette_webapi._app)
@pytest.fixture
def moulinette_cli(moulinette):
# Dirty hack needed, otherwise cookies ain't reused between request .. not
# sure why :|
import argparse
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--debug',
action='store_true', default=False,
help="Log and print debug messages",
)
moulinette_cli = moulinette.core.init_interface(
"cli",
actionsmap={"namespaces": ["moulitest"], "use_cache": False, "parser_kwargs": {'top_parser': parser}},
)
return moulinette_cli
@pytest.fixture
def test_file(tmp_path):
test_text = "foo\nbar\n"