Fix bug in error handlers.

Correct spelling error
This commit is contained in:
Rebecca Law
2016-03-11 10:16:06 +00:00
parent 4ba801edab
commit f63a85d003
5 changed files with 24 additions and 10 deletions

View File

@@ -0,0 +1,21 @@
from bs4 import BeautifulSoup
from flask import url_for
def test_bad_url_returns_page_not_found(app_):
with app_.test_client() as client:
response = client.get('/bad_url')
assert response.status_code == 404
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.h1.string.strip() == 'Page could not be found'
def test_bad_input_returns_something(app_, api_user_active, mock_login):
with app_.test_request_context():
with app_.test_client() as client:
client.login(api_user_active)
response = client.get(url_for('main.service_dashboard', service_id=1))
response.status == 404
print(response.get_data(as_text=True))
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.h1.string.strip() == 'Page could not be found'

View File

@@ -257,4 +257,4 @@ def test_new_invited_user_verifies_and_added_to_service(app_,
assert service_link == '/services/{}/dashboard'.format(service_one['id'])
flash_banner = page.find('div', class_='banner-default-with-tick').string.strip()
assert flash_banner == 'You have sucessfully accepted your invitation and been added to Test Service'
assert flash_banner == 'You have successfully accepted your invitation and been added to Test Service'

View File

@@ -19,8 +19,6 @@ def test_sign_out_user(app_,
mock_login,
mock_get_jobs):
with app_.test_request_context():
email = 'valid@example.gov.uk'
password = 'val1dPassw0rd!'
with app_.test_client() as client:
client.login(api_user_active)
with client.session_transaction() as session: