Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_cannot_apply_an_unamed_probe():
step = {}
with pytest.raises(ValueError) as excinfo:
apply_probe(step.get("name"), step, None)
assert "missing probe name" in str(excinfo)
"""
probe = get_probe_from_step(step, "steady")
if probe is None:
return
if "name" not in probe:
raise InvalidPlan("steady probe requires a probe name to apply")
if "layer" not in probe:
raise InvalidPlan("steady probe requires the target layer to be set")
if probe:
probe_name = probe.pop("name")
layer = layers.get(probe["layer"])
logger.info(" Applying steady probe '{name}'".format(name=probe_name))
apply_probe(probe_name, probe, layer)
"""
probe = get_probe_from_step(step, "close")
if probe is None:
return
if "name" not in probe:
raise InvalidPlan("close probe requires a probe name to apply")
if "layer" not in probe:
raise InvalidPlan("close probe requires the target layer to be set")
if probe:
probe_name = probe.pop("name")
layer = layers.get(probe["layer"])
logger.info(" Applying close probe '{name}'".format(name=probe_name))
apply_probe(probe_name, probe, layer)