PR fixes
This commit is contained in:
@@ -54,8 +54,6 @@ def test_delete(application_role, environment, monkeypatch):
|
||||
application_role=application_role, environment=environment
|
||||
)
|
||||
assert EnvironmentRoles.delete(application_role.id, environment.id)
|
||||
assert env_role.status == EnvironmentRole.Status.DISABLED
|
||||
assert env_role.deleted
|
||||
assert not EnvironmentRoles.delete(application_role.id, environment.id)
|
||||
|
||||
|
||||
@@ -102,12 +100,3 @@ def test_get_for_update(application_role, environment):
|
||||
assert role.application_role == application_role
|
||||
assert role.environment == environment
|
||||
assert role.deleted
|
||||
|
||||
|
||||
def test_get_all_for_application_member(application_role, environment):
|
||||
EnvironmentRoleFactory.create(
|
||||
application_role=application_role, environment=environment, deleted=True
|
||||
)
|
||||
|
||||
roles = EnvironmentRoles.get_all_for_application_member(application_role.id)
|
||||
assert len(roles) == 1
|
||||
|
@@ -46,7 +46,6 @@ def test_update_env_role_no_access():
|
||||
env_role.application_role.id, env_role.environment.id
|
||||
)
|
||||
assert env_role.role is None
|
||||
assert env_role.deleted
|
||||
assert env_role.status == EnvironmentRole.Status.DISABLED
|
||||
|
||||
|
||||
@@ -66,7 +65,6 @@ def test_update_env_role_deleted_role():
|
||||
env_role.environment, env_role.application_role, CSPRole.TECHNICAL_READ.value
|
||||
)
|
||||
assert env_role.role is None
|
||||
assert env_role.deleted
|
||||
assert env_role.status == EnvironmentRole.Status.DISABLED
|
||||
|
||||
|
||||
|
@@ -10,7 +10,7 @@ def test_environment_form():
|
||||
"environment_id": 123,
|
||||
"environment_name": "testing",
|
||||
"role": ENV_ROLES[0][0],
|
||||
"deleted": True,
|
||||
"disabled": True,
|
||||
}
|
||||
form = EnvironmentForm(data=form_data)
|
||||
assert form.validate()
|
||||
@@ -25,7 +25,7 @@ def test_environment_form_default_no_access():
|
||||
"environment_id": 123,
|
||||
"environment_name": "testing",
|
||||
"role": None,
|
||||
"deleted": False,
|
||||
"disabled": False,
|
||||
}
|
||||
|
||||
|
||||
|
@@ -129,10 +129,14 @@ def test_edit_application_environments_obj(app, client, user_session):
|
||||
assert env_obj["name"] == env.name
|
||||
assert env_obj["id"] == env.id
|
||||
assert isinstance(env_obj["edit_form"], EditEnvironmentForm)
|
||||
assert (
|
||||
env_obj["members"].sort()
|
||||
== [app_role1.user_name, app_role2.user_name].sort()
|
||||
)
|
||||
assert {
|
||||
"user_name": app_role1.user_name,
|
||||
"status": env_role1.status.value,
|
||||
} in env_obj["members"]
|
||||
assert {
|
||||
"user_name": app_role2.user_name,
|
||||
"status": env_role2.status.value,
|
||||
} in env_obj["members"]
|
||||
assert isinstance(context["audit_events"], Paginator)
|
||||
|
||||
|
||||
@@ -503,7 +507,7 @@ def test_update_member(client, user_session, session):
|
||||
env_1 = EnvironmentFactory.create(application=application)
|
||||
env_2 = EnvironmentFactory.create(application=application)
|
||||
# add user to two of the environments: env and env_1
|
||||
EnvironmentRoleFactory.create(
|
||||
updated_role = EnvironmentRoleFactory.create(
|
||||
environment=env, application_role=app_role, role=CSPRole.BASIC_ACCESS.value
|
||||
)
|
||||
suspended_role = EnvironmentRoleFactory.create(
|
||||
@@ -525,7 +529,7 @@ def test_update_member(client, user_session, session):
|
||||
"environment_roles-0-environment_name": env.name,
|
||||
"environment_roles-1-environment_id": env_1.id,
|
||||
"environment_roles-1-environment_name": env_1.name,
|
||||
"environment_roles-1-deleted": "True",
|
||||
"environment_roles-1-disabled": "True",
|
||||
"environment_roles-2-environment_id": env_2.id,
|
||||
"environment_roles-2-role": CSPRole.NETWORK_ADMIN.value,
|
||||
"environment_roles-2-environment_name": env_2.name,
|
||||
@@ -556,13 +560,10 @@ def test_update_member(client, user_session, session):
|
||||
)
|
||||
|
||||
environment_roles = application.roles[0].environment_roles
|
||||
# make sure that old env role was deleted and there are only 2 env roles
|
||||
assert len(environment_roles) == 2
|
||||
# check that the user has roles in the correct envs
|
||||
assert environment_roles[0].environment in [env, env_2]
|
||||
assert environment_roles[1].environment in [env, env_2]
|
||||
assert len(environment_roles) == 3
|
||||
assert updated_role.role == CSPRole.TECHNICAL_READ.value
|
||||
assert suspended_role.status == EnvironmentRole.Status.DISABLED
|
||||
assert suspended_role.deleted
|
||||
|
||||
|
||||
def test_revoke_invite(client, user_session):
|
||||
|
Reference in New Issue
Block a user