Merge pull request #945 from dod-ccpo/dont-show-deleted-portfolios

Do not return deactivated portfolios in Portfolios.for_user
This commit is contained in:
dandds
2019-06-19 10:44:33 -04:00
committed by GitHub
2 changed files with 7 additions and 0 deletions

View File

@@ -48,6 +48,7 @@ class PortfoliosQuery(Query):
),
)
)
.filter(Portfolio.deleted == False)
.order_by(Portfolio.name.asc())
.all()
)

View File

@@ -219,3 +219,9 @@ def test_delete_failure_with_applications():
Portfolios.delete(portfolio=portfolio)
assert not portfolio.deleted
def test_for_user_does_not_include_deleted_portfolios():
user = UserFactory.create()
PortfolioFactory.create(owner=user, deleted=True)
assert len(Portfolios.for_user(user)) == 0