def test_delete_success(): portfolio = PortfolioFactory.create() assert not portfolio.deleted Portfolios.delete(portfolio=portfolio) assert portfolio.deleted
def test_delete_failure_with_applications(): portfolio = PortfolioFactory.create() application = ApplicationFactory.create(portfolio=portfolio) assert not portfolio.deleted with pytest.raises(PortfolioDeletionApplicationsExistError): Portfolios.delete(portfolio=portfolio) assert not portfolio.deleted
def delete_portfolio(portfolio_id): Portfolios.delete(portfolio=g.portfolio) flash("portfolio_deleted", portfolio_name=g.portfolio.name) return redirect(url_for("atst.home"))