コード例 #1
0
def test_lazy_load():
    import clientcentral.query as operators

    print(pytest.ticket_id)
    ticket = (cc.query_tickets().filter_by(
        operators.and_(
            operators.comparison("created_by_user.email", "=",
                                 "'*****@*****.**'"),
            operators.comparison("id", "=", str(pytest.ticket_id)),
        )).all()[0])
    assert ticket is not None
    assert ticket.status.open == True
    assert ticket.status.closed == False

    assert hasattr(ticket, "_comments_attribute") == False
    assert hasattr(ticket, "_change_events_attribute") == False
    assert hasattr(ticket, "_events_attribute") == False
    assert hasattr(ticket, "_custom_fields_attribute") == False
    assert hasattr(ticket, "_available_buttons_attribute") == False

    ticket.comments

    assert hasattr(ticket, "_comments_attribute") == True
    assert hasattr(ticket, "_change_events_attribute") == True
    assert hasattr(ticket, "_events_attribute") == True
    assert hasattr(ticket, "_custom_fields_attribute") == True
    assert hasattr(ticket, "_available_buttons_attribute") == True

    assert "<" not in ticket.comments[0].get_comment_text()
    assert ">" not in ticket.comments[0].get_comment_text()
コード例 #2
0
def test_ticket_created_from_email():
    # 90771
    # Should not raise NoneType exception
    ticket = cc.get_ticket_by_id(90771)

    # Should not raise NoneType exception
    tickets = (cc.query_tickets().filter_by(
        operators.and_(operators.comparison("id", "=", "90771"), )).all())
コード例 #3
0
def test_button_press_from_ticket_query():
    import clientcentral.query as operators

    ticket = (cc.query_tickets().filter_by(
        operators.and_(
            operators.comparison("created_by_user.email", "=",
                                 "'*****@*****.**'"),
            operators.comparison("id", "=", str(pytest.ticket_id)),
        )).all()[0])
    assert ticket is not None
    assert ticket.available_buttons is not None
コード例 #4
0
def test_query_internal_event():
    import clientcentral.query as operators

    ticket = (cc.query_tickets().filter_by(
        operators.and_(
            operators.comparison("created_by_user.email", "=",
                                 "'*****@*****.**'"),
            operators.comparison("workspace_id", "=", 141),
        )).all()[1])

    # assert ticket.assignee is not None
    assert ticket.status is not None
    assert ticket.type is not None
    assert ticket.workspace_id is not None

    ticket.commit("not visible", commit_internal=True)
    # ticket.refresh()
    assert ticket.events[0].internal is True

    ticket.commit("visible", commit_internal=False)
    # ticket.refresh()
    assert ticket.events[0].internal is False
コード例 #5
0
def test_new_bug():
    tickets = (cc.query_tickets().filter_by(
        operators.and_(
            operators.statement("status.open"),
            operators.comparison("workspace_id", "=", "87"),
        )).all())