add a test for cmd with %
This commit is contained in:
parent
04101c11e0
commit
09f65b2dc3
|
@ -43,7 +43,10 @@ async def get_version():
|
|||
async def __call__(name, config):
|
||||
|
||||
if isinstance(config, dict):
|
||||
_config = configparser.ConfigParser(dict_type=dict, allow_no_value=True)
|
||||
_config = configparser.ConfigParser(
|
||||
dict_type=dict, allow_no_value=True,
|
||||
interpolation=None,
|
||||
)
|
||||
_config.read_dict({name: config})
|
||||
config = _config[name]
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# MIT licensed
|
||||
# Copyright (c) 2013-2017 lilydjwg <lilydjwg@gmail.com>, et al.
|
||||
|
||||
import time
|
||||
import pytest
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
@ -9,3 +10,12 @@ async def test_cmd(get_version):
|
|||
|
||||
async def test_cmd_complex(get_version):
|
||||
assert await get_version("example", {"cmd": "echo Meow | sed 's/meow/woof/i'"}) == "woof"
|
||||
|
||||
async def test_cmd_with_percent(run_source):
|
||||
test_conf = '''\
|
||||
[example]
|
||||
cmd = date +%Y-%m-%d'''
|
||||
date = await run_source(test_conf)
|
||||
expected = time.strftime('%Y-%m-%d')
|
||||
assert date == expected
|
||||
|
||||
|
|
Loading…
Reference in New Issue