From 109b41a430bc869b5d6d9eade33ffd8853b6319a Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Sat, 15 Jul 2017 07:23:22 +0100 Subject: [PATCH] Fix broken link in support process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The idea is if you decide your problem isn’t such an emergency after all, we direct you to the form where you can report it as such. This link wasn’t working because it didn’t understand `False` to mean ‘not severe’. Only ‘no’ means not severe. The result was that users got sent in a bit of a convoluted loop where they were asked again if their problem was an emergency or not. Testing this by making sure that both: - the URL in the link is what we expected - when visited it gives the page title we expect Because even if we had had the first test only, it wouldn’t have caught this bug. --- app/templates/views/support/bat-phone.html | 2 +- tests/app/main/views/test_feedback.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/templates/views/support/bat-phone.html b/app/templates/views/support/bat-phone.html index f21ea59c2..8e9ec3eef 100644 --- a/app/templates/views/support/bat-phone.html +++ b/app/templates/views/support/bat-phone.html @@ -33,7 +33,7 @@

Any other problems

- Fill in this form + Fill in this form and we’ll get back to you by the next working day.

diff --git a/tests/app/main/views/test_feedback.py b/tests/app/main/views/test_feedback.py index 97e1ae0d7..3d78c64c6 100644 --- a/tests/app/main/views/test_feedback.py +++ b/tests/app/main/views/test_feedback.py @@ -449,6 +449,13 @@ def test_bat_email_page( response = client.get(bat_phone_page) assert response.status_code == 200 + page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser') + assert page.select('main a')[1].text == 'Fill in this form' + assert page.select('main a')[1]['href'] == url_for('main.feedback', ticket_type='problem', severe='no') + next_page_response = client.get(page.select('main a')[1]['href']) + next_page = BeautifulSoup(next_page_response.data.decode('utf-8'), 'html.parser') + assert next_page.h1.text.strip() == 'Report a problem' + client.login(active_user_with_permissions, mocker, service_one) logged_in_response = client.get(bat_phone_page) assert logged_in_response.status_code == 302