Refactor application team routes
- pulling out helper functions for constructing forms - return 400 for form validation errors - "Yes" appears green on the read only version
This commit is contained in:
@@ -9,7 +9,7 @@ def test_permissions_form_permission_sets():
|
||||
form_data = {
|
||||
"perms_team_mgmt": PermissionSets.EDIT_APPLICATION_TEAM,
|
||||
"perms_env_mgmt": PermissionSets.VIEW_APPLICATION,
|
||||
"perms_del_env": "View only",
|
||||
"perms_del_env": PermissionSets.VIEW_APPLICATION,
|
||||
}
|
||||
form = PermissionsForm(data=form_data)
|
||||
|
||||
@@ -17,7 +17,7 @@ def test_permissions_form_permission_sets():
|
||||
assert form.data == [
|
||||
PermissionSets.EDIT_APPLICATION_TEAM,
|
||||
PermissionSets.VIEW_APPLICATION,
|
||||
"View only",
|
||||
PermissionSets.VIEW_APPLICATION,
|
||||
]
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ def test_permissions_form_invalid():
|
||||
form_data = {
|
||||
"perms_team_mgmt": PermissionSets.EDIT_APPLICATION_TEAM,
|
||||
"perms_env_mgmt": "not a real choice",
|
||||
"perms_del_env": "View only",
|
||||
"perms_del_env": PermissionSets.VIEW_APPLICATION,
|
||||
}
|
||||
form = PermissionsForm(data=form_data)
|
||||
assert not form.validate()
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import pytest
|
||||
from flask import url_for
|
||||
|
||||
from atst.domain.permission_sets import PermissionSets
|
||||
@@ -62,6 +63,7 @@ def test_update_team_with_bad_permission_sets(client, user_session):
|
||||
"members-0-permission_sets-perms_env_mgmt": "some random string",
|
||||
},
|
||||
)
|
||||
assert response.status_code == 400
|
||||
assert app_user.permission_sets == permission_sets
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user