test .yaml.local (#269)

This commit is contained in:
mmetc
2023-05-03 13:10:56 +02:00
committed by GitHub
parent 2fa4003255
commit 9f27212e5b
3 changed files with 24 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
[packages]
pytest-cs = {ref = "0.7.14", git = "https://github.com/crowdsecurity/pytest-cs.git"}
pytest-cs = {ref = "0.7.15", git = "https://github.com/crowdsecurity/pytest-cs.git"}
pytest-dotenv = "0.5.2"
pytest-dependency = "0.5.1"
pexpect = "4.8.0"

4
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "d08dab481f1fc73b002ef4bde1d64d19638faf31314dca9c25c73894cef58ec6"
"sha256": "ddd1ae2f37f2d88866a7605de0d8774c71a1311497032339bebec6c2daea0607"
},
"pipfile-spec": 6,
"requires": {
@@ -395,7 +395,7 @@
},
"pytest-cs": {
"git": "https://github.com/crowdsecurity/pytest-cs.git",
"ref": "4bf6f42da3332104b709709202de81eb86d0f025"
"ref": "e146c11a6024f5156e590f25483d822badea6bb3"
},
"pytest-datadir": {
"hashes": [

View File

@@ -0,0 +1,21 @@
def test_yaml_local(bouncer, fw_cfg_factory):
cfg = fw_cfg_factory()
with bouncer(cfg) as fw:
fw.wait_for_lines_fnmatch([
"*unable to load configuration: config does not contain 'mode'*",
])
fw.proc.wait(timeout=0.2)
assert not fw.proc.is_running()
config_local = {
'mode': 'whatever'
}
with bouncer(cfg, config_local=config_local) as fw:
fw.wait_for_lines_fnmatch([
"*firewall 'whatever' is not supported*",
])
fw.proc.wait(timeout=0.2)
assert not fw.proc.is_running()