Beispiel #1
0
def test_transactions_created_for_calendars(db, default_namespace):
    calendar = Calendar(namespace_id=default_namespace.id,
                        name='New Calendar',
                        uid='uid')
    db.session.add(calendar)
    db.session.commit()
    transaction = get_latest_transaction(db.session, 'calendar', calendar.id,
                                         default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == 'calendar'
    assert transaction.command == 'insert'

    calendar.name = 'Updated Calendar'
    db.session.commit()
    transaction = get_latest_transaction(db.session, 'calendar', calendar.id,
                                         default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == 'calendar'
    assert transaction.command == 'update'

    db.session.delete(calendar)
    db.session.commit()
    transaction = get_latest_transaction(db.session, 'calendar', calendar.id,
                                         default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == 'calendar'
    assert transaction.command == 'delete'
def test_transactions_created_for_calendars(db, default_namespace):
    calendar = Calendar(
        namespace_id=default_namespace.id, name="New Calendar", uid="uid"
    )
    db.session.add(calendar)
    db.session.commit()
    transaction = get_latest_transaction(
        db.session, "calendar", calendar.id, default_namespace.id
    )
    assert transaction.record_id == calendar.id
    assert transaction.object_type == "calendar"
    assert transaction.command == "insert"

    calendar.name = "Updated Calendar"
    db.session.commit()
    transaction = get_latest_transaction(
        db.session, "calendar", calendar.id, default_namespace.id
    )
    assert transaction.record_id == calendar.id
    assert transaction.object_type == "calendar"
    assert transaction.command == "update"

    db.session.delete(calendar)
    db.session.commit()
    transaction = get_latest_transaction(
        db.session, "calendar", calendar.id, default_namespace.id
    )
    assert transaction.record_id == calendar.id
    assert transaction.object_type == "calendar"
    assert transaction.command == "delete"
def test_transactions_created_for_calendars(db, default_namespace):
    calendar = Calendar(
        namespace_id=default_namespace.id,
        name='New Calendar',
        uid='uid')
    db.session.add(calendar)
    db.session.commit()
    transaction = get_latest_transaction(db.session, 'calendar',
                                         calendar.id, default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == 'calendar'
    assert transaction.command == 'insert'

    calendar.name = 'Updated Calendar'
    db.session.commit()
    transaction = get_latest_transaction(db.session, 'calendar',
                                         calendar.id, default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == 'calendar'
    assert transaction.command == 'update'

    db.session.delete(calendar)
    db.session.commit()
    transaction = get_latest_transaction(db.session, 'calendar',
                                         calendar.id, default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == 'calendar'
    assert transaction.command == 'delete'
def test_transactions_created_for_calendars(db, default_namespace):
    calendar = Calendar(namespace_id=default_namespace.id, name="New Calendar", uid="uid")
    db.session.add(calendar)
    db.session.commit()
    transaction = get_latest_transaction(db.session, "calendar", calendar.id, default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == "calendar"
    assert transaction.command == "insert"

    calendar.name = "Updated Calendar"
    db.session.commit()
    transaction = get_latest_transaction(db.session, "calendar", calendar.id, default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == "calendar"
    assert transaction.command == "update"

    db.session.delete(calendar)
    db.session.commit()
    transaction = get_latest_transaction(db.session, "calendar", calendar.id, default_namespace.id)
    assert transaction.record_id == calendar.id
    assert transaction.object_type == "calendar"
    assert transaction.command == "delete"