Example #1
0
def test_drop_trigger(memgraph: Memgraph):
    trigger = MemgraphTrigger(
        name="test_trigger",
        event_type=TriggerEventType.CREATE,
        event_object=TriggerEventObject.ALL,
        execution_phase=TriggerExecutionPhase.BEFORE,
        statement="CREATE (:Node)",
    )

    memgraph.create_trigger(trigger)
    memgraph.drop_trigger(trigger)
    assert len(memgraph.get_triggers()) == 0
Example #2
0
def test_create_get_trigger(memgraph: Memgraph):
    trigger = MemgraphTrigger(
        name="test_trigger",
        event_type=TriggerEventType.CREATE,
        event_object=TriggerEventObject.ALL,
        execution_phase=TriggerExecutionPhase.BEFORE,
        statement="CREATE (:Node)",
    )

    memgraph.create_trigger(trigger)
    assert any(
        map(lambda t: t["trigger name"] == "test_trigger",
            memgraph.get_triggers()))