Add link to delete a template

This is a link not a button because:
- it’s less prominent—delete is an infrequent action
- it’s a two-step process, and only the second part changes any data (so it has
  a button)
This commit is contained in:
Chris Hill-Scott
2016-01-14 09:44:06 +00:00
parent 2554fbe0e0
commit 1e0f5c27b9
8 changed files with 126 additions and 29 deletions

View File

@@ -11,12 +11,12 @@ def test_should_return_list_of_all_templates(notifications_admin, notifications_
assert response.status_code == 200
def test_should_show_page_for_one_templates(notifications_admin, notifications_admin_db, notify_db_session):
def test_should_show_page_for_one_template(notifications_admin, notifications_admin_db, notify_db_session):
with notifications_admin.test_request_context():
with notifications_admin.test_client() as client:
user = create_test_user('active')
client.login(user)
response = client.get('/services/123/templates/template')
response = client.get('/services/123/templates/1')
assert response.status_code == 200
@@ -26,7 +26,29 @@ def test_should_redirect_when_saving_a_template(notifications_admin, notificatio
with notifications_admin.test_client() as client:
user = create_test_user('active')
client.login(user)
response = client.post('/services/123/templates/template')
response = client.post('/services/123/templates/1')
assert response.status_code == 302
assert response.location == 'http://localhost/services/123/templates'
def test_should_show_delete_template_page(notifications_admin, notifications_admin_db, notify_db_session):
with notifications_admin.test_request_context():
with notifications_admin.test_client() as client:
user = create_test_user('active')
client.login(user)
response = client.get('/services/123/templates/1/delete')
assert response.status_code == 200
assert 'Are you sure' in response.get_data(as_text=True)
def test_should_redirect_when_deleting_a_template(notifications_admin, notifications_admin_db, notify_db_session):
with notifications_admin.test_request_context():
with notifications_admin.test_client() as client:
user = create_test_user('active')
client.login(user)
response = client.post('/services/123/templates/1/delete')
assert response.status_code == 302
assert response.location == 'http://localhost/services/123/templates'