def test_safe_update__ok__nominal_case(self, session, app_config, admin_user) -> None: assert session.query(Workspace).all() == [] cleanup_lib = CleanupLib(app_config=app_config, session=session, dry_run_mode=False) test_workspace = Workspace() test_workspace.owner_id = admin_user.user_id cleanup_lib.safe_update(test_workspace) transaction.commit() assert session.query(Workspace).one() == test_workspace
def test_safe_update__ok__dry_run(self, session, app_config, admin_user) -> None: assert session.query(Workspace).all() == [] cleanup_lib = CleanupLib(app_config=app_config, session=session, dry_run_mode=True) test_workspace = Workspace() test_workspace.owner_id = admin_user.user_id cleanup_lib.safe_update(test_workspace) transaction.commit() with pytest.raises(NoResultFound): assert session.query(Workspace).one() == test_workspace