def test_validate_response_invalid_error_key_type(): for bad in [{}, None, 1, lambda x: x, set()]: with pytest.raises(plugins.ValidationException): plugins.validate_response({ "type": "rule", "error_key": bad })
def test_validate_fingerprint_invalid_fingerprint_key_type(): for bad in [{}, None, 1, lambda x: x, set()]: with pytest.raises(plugins.ValidationException): plugins.validate_response({ "type": "fingerprint", "fingerprint_key": bad })
def test_validate_response_missing_fingerprint_key(): with pytest.raises(plugins.ValidationException): plugins.validate_response({"type": "fingerprint", "foo": "bar"})
def test_validate_fingerprint_good(): assert plugins.validate_response({ "type": "fingerprint", "fingerprint_key": "FINGERPRINT", "foo": "bar"}) is None
def test_validate_response_missing_error_key(): with pytest.raises(plugins.ValidationException): plugins.validate_response({"type": "rule", "foo": "bar"})
def test_validate_response_invalid_type_key(): with pytest.raises(plugins.ValidationException): plugins.validate_response({"type": "dance off"})
def test_validate_response_missing_type(): with pytest.raises(plugins.ValidationException): plugins.validate_response({"error_key": "an_error"})
def test_validate_response_invalid_types(): for bad in [[], None, set(), "", 1, lambda x: x]: with pytest.raises(plugins.ValidationException): plugins.validate_response(bad)
def test_validate_response_good(): assert plugins.validate_response({ "type": "rule", "error_key": "a_test", "foo": "bar"}) is None