Update test_for_user to make variables clearer and add in a test case that should not be included in the list returned.

Use list comprehension in portfolio_applications route to get list of all environments for a user
This commit is contained in:
leigh-mil
2019-12-11 10:35:42 -05:00
parent 78e7b1efe8
commit d3f757c649
2 changed files with 21 additions and 14 deletions

View File

@@ -25,9 +25,9 @@ def has_portfolio_applications(_user, portfolio=None, **_kwargs):
)
def portfolio_applications(portfolio_id):
user_env_roles = EnvironmentRoles.for_user(g.current_user.id, portfolio_id)
environment_access = {}
for env_role in user_env_roles:
environment_access[env_role.environment_id] = env_role.role
environment_access = {
env_role.environment_id: env_role.role for env_role in user_env_roles
}
return render_template(
"applications/index.html", environment_access=environment_access