when not logged in, redirect to sign-in

parts of the initial setup/login stages were throwing 500s if user
not already in process (ie: user directly navigated to url):
* /resend-email-verification
* /text-not-received
* /send-new-code
* verify
This commit is contained in:
Leo Hemsted
2016-06-17 11:36:30 +01:00
parent 7be111d260
commit 539950d772
6 changed files with 44 additions and 16 deletions

View File

@@ -147,3 +147,11 @@ def test_verify_email_redirects_to_sign_in_if_user_active(app_,
assert page.h1.text == 'Sign in'
flash_banner = page.find('div', class_='banner-dangerous').string.strip()
assert flash_banner == "That verification link has expired."
def test_verify_redirects_to_sign_in_if_not_logged_in(app_):
with app_.test_request_context(), app_.test_client() as client:
response = client.get(url_for('main.verify'))
assert response.location == url_for('main.sign_in', _external=True)
assert response.status_code == 302