You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.2 KiB
60 lines
1.2 KiB
# pylint: disable=redefined-outer-name
|
|
from pathlib import Path
|
|
import logging
|
|
|
|
from click.testing import CliRunner
|
|
import pytest
|
|
|
|
from shepherd.agent.cli import cli
|
|
|
|
|
|
def test_shepherd_template():
|
|
# Note that the CliRunner doesn't catch log output
|
|
runner = CliRunner()
|
|
result = runner.invoke(cli, ['template'])
|
|
assert """
|
|
.: Shepherd - Template :.
|
|
|
|
:: Config template for [shepherd]
|
|
|
|
[shepherd]
|
|
name =""" in result.output
|
|
|
|
|
|
def test_shepherd_optional_template():
|
|
runner = CliRunner()
|
|
result = runner.invoke(cli, ['template', '-a'])
|
|
assert """
|
|
.: Shepherd - Template :.
|
|
|
|
:: Config template for [shepherd]
|
|
|
|
[shepherd]
|
|
name =
|
|
root_dir = "./"
|
|
custom_config_path =
|
|
compiled_config_path = "compiled-config.toml"
|
|
plugin_dir = "./shepherd-plugins"
|
|
|
|
[shepherd.session]
|
|
resume_delay = 180
|
|
enable_suspend = true
|
|
min_suspend_time = 300
|
|
|
|
[shepherd.control]
|
|
server =
|
|
intro_key =""" in result.output
|
|
|
|
|
|
def test_plugin_template(request):
|
|
plugindir = Path(request.fspath.dirname)/'assets'
|
|
runner = CliRunner()
|
|
result = runner.invoke(cli, ['template', '-d', str(plugindir), 'simpletestplugin'])
|
|
assert """
|
|
.: Shepherd - Template :.
|
|
|
|
:: Config template for [simpletestplugin]
|
|
|
|
[simpletestplugin]
|
|
spec1 =""" in result.output
|