Ejemplo n.º 1
0
def test_get_tickets_with_multiple_commands(ticket_app: TicketsApplication):
    with freeze_time("2012-01-14"):
        ticket = ticket_app.create_ticket(name="original name")
        ticket_id = str(ticket.id)
    with freeze_time("2012-01-15"):
        ticket_app.rename_ticket(ticket_id, "new ticket name")
        ticket_app.update_ticket_description(ticket_id,
                                             "new ticket description")

    assert tickets_as_assertable_tickets(ticket_app.get_tickets()) == [
        AssertableTicket(
            id=any_instance_of(str),
            name="new ticket name",
            description="new ticket description",
            updated_at="2012-01-15T00:00:00",
            history=[
                TicketFieldUpdated(
                    field="name",
                    old_value="original name",
                    new_value="new ticket name",
                    timestamp=datetime(year=2012, month=1, day=15),
                ),
                TicketFieldUpdated(
                    field="description",
                    old_value=None,
                    new_value="new ticket description",
                    timestamp=datetime(year=2012, month=1, day=15),
                ),
            ],
        )
    ]
Ejemplo n.º 2
0
def test_get_tickets_when_two_created(ticket_app: TicketsApplication):
    with freeze_time("2012-01-14"):
        ticket_app.create_ticket(name="first ticket")
    with freeze_time("2012-01-15"):
        ticket_app.create_ticket(name="second ticket")

    assert tickets_as_assertable_tickets(ticket_app.get_tickets()) == [
        AssertableTicket(
            id=any_instance_of(str),
            name="first ticket",
            description=None,
            updated_at="2012-01-14T00:00:00",
            history=[],
        ),
        AssertableTicket(
            id=any_instance_of(str),
            name="second ticket",
            description=None,
            updated_at="2012-01-15T00:00:00",
            history=[],
        ),
    ]
Ejemplo n.º 3
0
def test_get_tickets_with_deleted_tickets(ticket_app: TicketsApplication):
    ticket = ticket_app.create_ticket()
    ticket_id = str(ticket.id)
    ticket_app.delete_ticket(ticket_id)

    assert ticket_app.get_tickets() == []
Ejemplo n.º 4
0
def test_get_tickets_when_none_created(ticket_app: TicketsApplication):
    assert ticket_app.get_tickets() == []