def test_emit_event_badschema():
    """
    Test failure when event doesn't match schema
    """
    schema = {
        "$id": "test/test",
        "version": 1,
        "properties": {
            "something": {"type": "string"},
            "status": {"enum": ["success", "failure"]},
        },
    }
    with tempfile.NamedTemporaryFile() as f:
        handler = logging.FileHandler(f.name)
        el = EventLog(handlers_maker=lambda el: [handler])
        el.register_schema(schema)

        with pytest.raises(jsonschema.ValidationError):
            el.emit("test/test", 1, {"something": "blah", "status": "not-in-enum"})

    Test failure when event doesn't match schema
    
binderhub/tests/test_eventlog.py