Beispiel #1
0
def test_get_object_versions(
        session: sessionmaker(), objects: VersionedJSONSerializableObjectTables
) -> None:
    user1 = User(name="User 1")
    session.add(user1)
    action = Action(id=0, schema={})
    session.add(action)
    session.commit()
    object1 = objects.create_object(action_id=action.id,
                                    data={},
                                    schema={},
                                    user_id=user1.id)
    user2 = User(name="User 2")
    session.add(user2)
    session.commit()
    object2 = objects.update_object(object1.object_id,
                                    data={'test': 1},
                                    schema={},
                                    user_id=user2.id)
    object_versions = objects.get_object_versions(object1.object_id)
    assert object_versions == [object1, object2]
Beispiel #2
0
def test_get_object_versions_errors(
        session: sessionmaker(), objects: VersionedJSONSerializableObjectTables
) -> None:
    object_versions = objects.get_object_versions(0)
    assert object_versions == []