Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_results_from_colin_labels_image(image, ruleset_name=None, ruleset_file=None, ruleset=None):
return colin.run(image.target_name, image.target_type, ruleset_name=ruleset_name,
ruleset_file=ruleset_file, ruleset=ruleset)
def get_results_from_colin_labels_image(target, parent_target=None):
return colin.run(target=target.target_name,
parent_target=parent_target,
target_type=target.target_type,
ruleset_name="fedora",
logging_level=logging.DEBUG, pull=False)
def get_colin_test_image():
return colin.run("colin-test")
def test_podman_image_target(ruleset):
results = colin.run(LABELS_IMAGE, "image", ruleset=ruleset, logging_level=10, pull=False)
assert results.ok
assert results.results_per_check["url_label"].ok
def test_unknown_check(ruleset_unknown_check):
with pytest.raises(ColinRulesetException) as ex:
colin.get_checks(ruleset=ruleset_unknown_check)
assert str(ex.value) == "Check i_forgot_the_name can't be loaded, we couldn't find it."
def test_ruleset_version(version, should_raise):
if version == "":
r = {"banana": 123}
else:
r = {"version": version}
if should_raise:
with pytest.raises(ColinRulesetException):
Ruleset(ruleset=r)
else:
assert Ruleset(ruleset=r)
def bad_fce():
raise ColinException("Error")
@exit_after(1)
def slow_fce():
time.sleep(2)
@exit_after(1)
def bad_fce():
raise ColinException("Error")
def test_timeout_dirrect():
with pytest.raises(TimeoutError):
exit_after(1)(time.sleep)(2)