Remove route, tests, and template code for deleting an application
This commit is contained in:
@@ -288,41 +288,6 @@ def test_user_can_only_access_apps_in_their_portfolio(client, user_session):
|
||||
assert time_updated == other_application.time_updated
|
||||
|
||||
|
||||
def test_delete_application(client, user_session):
|
||||
user = UserFactory.create()
|
||||
port = PortfolioFactory.create(
|
||||
owner=user,
|
||||
applications=[
|
||||
{
|
||||
"name": "mos eisley",
|
||||
"environments": [
|
||||
{"name": "bar"},
|
||||
{"name": "booth"},
|
||||
{"name": "band stage"},
|
||||
],
|
||||
}
|
||||
],
|
||||
)
|
||||
application = port.applications[0]
|
||||
user_session(user)
|
||||
|
||||
response = client.post(
|
||||
url_for("applications.delete", application_id=application.id)
|
||||
)
|
||||
# appropriate response and redirect
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for(
|
||||
"applications.portfolio_applications", portfolio_id=port.id, _external=True
|
||||
)
|
||||
# appropriate flash message
|
||||
message = get_flashed_messages()[0]
|
||||
assert "deleted" in message["message"]
|
||||
assert application.name in message["message"]
|
||||
# app and envs are soft deleted
|
||||
assert len(port.applications) == 0
|
||||
assert len(application.environments) == 0
|
||||
|
||||
|
||||
def test_new_environment(client, user_session):
|
||||
user = UserFactory.create()
|
||||
portfolio = PortfolioFactory(owner=user)
|
||||
|
@@ -343,40 +343,6 @@ def test_portfolios_invite_member_access(post_url_assert_status):
|
||||
post_url_assert_status(rando, url, 404)
|
||||
|
||||
|
||||
# applications.delete
|
||||
def test_applications_delete_access(post_url_assert_status, monkeypatch):
|
||||
ccpo = UserFactory.create_ccpo()
|
||||
owner = user_with()
|
||||
app_admin = user_with()
|
||||
rando = user_with()
|
||||
|
||||
portfolio = PortfolioFactory.create(
|
||||
owner=owner, applications=[{"name": "mos eisley"}]
|
||||
)
|
||||
application = portfolio.applications[0]
|
||||
|
||||
ApplicationRoleFactory.create(
|
||||
user=app_admin,
|
||||
application=application,
|
||||
permission_sets=PermissionSets.get_many(
|
||||
[
|
||||
PermissionSets.VIEW_APPLICATION,
|
||||
PermissionSets.EDIT_APPLICATION_ENVIRONMENTS,
|
||||
PermissionSets.EDIT_APPLICATION_TEAM,
|
||||
PermissionSets.DELETE_APPLICATION_ENVIRONMENTS,
|
||||
]
|
||||
),
|
||||
)
|
||||
|
||||
monkeypatch.setattr("atst.domain.applications.Applications.delete", lambda *a: True)
|
||||
|
||||
url = url_for("applications.delete", application_id=application.id)
|
||||
post_url_assert_status(app_admin, url, 404)
|
||||
post_url_assert_status(rando, url, 404)
|
||||
post_url_assert_status(owner, url, 302)
|
||||
post_url_assert_status(ccpo, url, 302)
|
||||
|
||||
|
||||
# applications.settings
|
||||
def test_application_settings_access(get_url_assert_status):
|
||||
ccpo = user_with(PermissionSets.VIEW_PORTFOLIO_APPLICATION_MANAGEMENT)
|
||||
|
Reference in New Issue
Block a user