def test_validate_good_response(): assert plugins.make_response("a_test", foo="bar") == { "type": "rule", "error_key": "a_test", "foo": "bar" } assert plugins.make_fail("a_test", foo="bar") == { "type": "rule", "error_key": "a_test", "foo": "bar" } assert plugins.make_pass("a_test", foo="bar") == { "type": "pass", "pass_key": "a_test", "foo": "bar" } assert plugins.make_fingerprint("a_test", foo="bar") == { "type": "fingerprint", "fingerprint_key": "a_test", "foo": "bar" } assert plugins.make_metadata(foo="bar") == { "type": "metadata", "foo": "bar" } assert plugins.make_metadata_key("foo", "bar") == { "type": "metadata_key", "key": "foo", "value": "bar" }
def _get_canonical_facts_response(canonical_facts): d = make_metadata(**canonical_facts) del d["type"] return d
def test_make_metadata(): assert plugins.make_metadata(foo="bar") == { "type": "metadata", "foo": "bar" }
def test_make_metadata_should_not_allow_type(): with pytest.raises(Exception): plugins.make_metadata(type="not_allowed", foo="bar")