Exemplo n.º 1
0
def _add_feedback_query(feedback_: Feedback):
    g = Traversel()

    # create SecurityEvent obj with only url as property, which is enough
    # to find the existing node to add feedback
    security_event = SecurityEvent(url=feedback_.feedback_url)

    g.has_node(security_event).and_(
        Traversel.anonymous().add_unique_node(feedback_))
    if feedback_.feedback_type is FeedBackType.NEGATIVE:
        g.weakens(feedback_, security_event)
    else:
        g.reinforces(feedback_, security_event)

    return str(g.next())
Exemplo n.º 2
0
def test_append_with_string_step():
    """Test append with string step."""
    g0 = Traversel('g').addV('hello').and_(Traversel.anonymous().addV('world'))
    g0.append("addV('foo')")
    assert str(g0) == "g.addV('hello').and(addV('world')).addV('foo')"
Exemplo n.º 3
0
def test_append_with_traversel_step():
    """Test append with traversel step."""
    g0 = Traversel('g').addV('hello').and_(Traversel.anonymous().addV('world'))
    g1 = Traversel.anonymous().addV('hello').and_(Traversel.anonymous().addV('world'))
    g0.append(g1)
    assert str(g0) == "g.addV('hello').and(addV('world')).addV('hello').and(addV('world'))"
Exemplo n.º 4
0
def test_and_step():
    """Test and step."""
    g = Traversel('g').addV('hello').and_(Traversel.anonymous().addV('world'))
    assert str(g) == "g.addV('hello').and(addV('world'))"