def test_add_and_get_data(get_example_data):
    with Session.begin() as s:
        CrudTable().add_data(s, get_example_data)
    with Session.begin() as s:
        assert len(CrudTable().get_data(s)) == 6
        assert len(CrudTable().get_data(s, user_name="Tom Cat")) == 1
        assert len(CrudTable().get_data(s, user_name="Jerry Mouse")) == 1
def test_update_data():
    new_data = {"email": "*****@*****.**"}
    with Session.begin() as s:
        target = CrudTable().get_data(s, email="*****@*****.**")
        assert len(target) == 0
        user = CrudTable().get_data(s, email="*****@*****.**")[0]
        CrudTable().update_data(user, new_data)
    with Session.begin() as s:
        target = CrudTable().get_data(s, email="*****@*****.**")
        assert len(target) == 1
def test_truncate_table():
    with Session.begin() as s:
        CrudTable().truncate_table(s)
    with Session.begin() as s:
        assert len(CrudTable.get_data(s)) == 0