Prevent error from being raised when user is not trying to update a

disabled env role

We were only checking to see if a role was disabled or deleted before
raising an error, so I added in a check to see if the user was trying to
update the env role before raising an error. The error should only be
raised if the role is disabled or deleted AND the user is trying to
assign a new role to the env role.

I also added in a disabled property to the EnvironmentRole model to make
things more readable.
This commit is contained in:
leigh-mil
2019-11-14 15:55:23 -05:00
parent b034d668a1
commit a4f21dc7e6
6 changed files with 18 additions and 16 deletions

View File

@@ -563,7 +563,7 @@ def test_update_member(client, user_session, session):
# check that the user has roles in the correct envs
assert len(environment_roles) == 3
assert updated_role.role == CSPRole.TECHNICAL_READ.value
assert suspended_role.status == EnvironmentRole.Status.DISABLED
assert suspended_role.disabled
def test_revoke_invite(client, user_session):