mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 19:58:24 -04:00
@@ -2,100 +2,100 @@ import json
|
|||||||
from flask import url_for
|
from flask import url_for
|
||||||
|
|
||||||
|
|
||||||
# def test_should_show_overview_page(app_,
|
def test_should_show_overview_page(app_,
|
||||||
# api_user_active,
|
api_user_active,
|
||||||
# mock_login,
|
mock_login,
|
||||||
# mock_get_user):
|
mock_get_user):
|
||||||
# with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
# with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
# client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
# response = client.get(url_for('main.user_profile'))
|
response = client.get(url_for('main.user_profile'))
|
||||||
|
|
||||||
# assert 'Your profile' in response.get_data(as_text=True)
|
assert 'Your profile' in response.get_data(as_text=True)
|
||||||
# assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# def test_should_show_name_page(app_,
|
def test_should_show_name_page(app_,
|
||||||
# api_user_active,
|
api_user_active,
|
||||||
# mock_login,
|
mock_login,
|
||||||
# mock_get_user):
|
mock_get_user):
|
||||||
# with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
# with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
# client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
# response = client.get(url_for('main.user_profile_name'))
|
response = client.get(url_for('main.user_profile_name'))
|
||||||
|
|
||||||
# assert 'Change your name' in response.get_data(as_text=True)
|
assert 'Change your name' in response.get_data(as_text=True)
|
||||||
# assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# def test_should_redirect_after_name_change(app_,
|
def test_should_redirect_after_name_change(app_,
|
||||||
# api_user_active,
|
api_user_active,
|
||||||
# mock_login,
|
mock_login,
|
||||||
# mock_update_user,
|
mock_update_user,
|
||||||
# mock_get_user):
|
mock_get_user):
|
||||||
# with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
# with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
# client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
# new_name = 'New Name'
|
new_name = 'New Name'
|
||||||
# data = {'new_name': new_name}
|
data = {'new_name': new_name}
|
||||||
# response = client.post(url_for(
|
response = client.post(url_for(
|
||||||
# 'main.user_profile_name'), data=data)
|
'main.user_profile_name'), data=data)
|
||||||
|
|
||||||
# assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
# assert response.location == url_for(
|
assert response.location == url_for(
|
||||||
# 'main.user_profile', _external=True)
|
'main.user_profile', _external=True)
|
||||||
# api_user_active.name = new_name
|
api_user_active.name = new_name
|
||||||
# assert mock_update_user.called
|
assert mock_update_user.called
|
||||||
|
|
||||||
|
|
||||||
# def test_should_show_email_page(app_,
|
def test_should_show_email_page(app_,
|
||||||
# api_user_active,
|
api_user_active,
|
||||||
# mock_login,
|
mock_login,
|
||||||
# mock_get_user):
|
mock_get_user):
|
||||||
# with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
# with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
# client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
# response = client.get(url_for(
|
response = client.get(url_for(
|
||||||
# 'main.user_profile_email'))
|
'main.user_profile_email'))
|
||||||
|
|
||||||
# assert 'Change your email address' in response.get_data(as_text=True)
|
assert 'Change your email address' in response.get_data(as_text=True)
|
||||||
# assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
# def test_should_redirect_after_email_change(app_,
|
def test_should_redirect_after_email_change(app_,
|
||||||
# api_user_active,
|
api_user_active,
|
||||||
# mock_login,
|
mock_login,
|
||||||
# mock_get_user,
|
mock_get_user,
|
||||||
# mock_get_user_by_email_not_found,
|
mock_get_user_by_email_not_found,
|
||||||
# mock_is_email_unique):
|
mock_is_email_unique):
|
||||||
# with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
# with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
# client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
# data = {'email_address': 'new_notify@notify.gov.uk'}
|
data = {'email_address': 'new_notify@notify.gov.uk'}
|
||||||
# response = client.post(
|
response = client.post(
|
||||||
# url_for('main.user_profile_email'),
|
url_for('main.user_profile_email'),
|
||||||
# data=data)
|
data=data)
|
||||||
|
|
||||||
# assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
# assert response.location == url_for(
|
assert response.location == url_for(
|
||||||
# 'main.user_profile_email_authenticate', _external=True)
|
'main.user_profile_email_authenticate', _external=True)
|
||||||
|
|
||||||
|
|
||||||
# def test_should_show_authenticate_after_email_change(app_,
|
def test_should_show_authenticate_after_email_change(app_,
|
||||||
# api_user_active,
|
api_user_active,
|
||||||
# mock_login,
|
mock_login,
|
||||||
# mock_get_user,
|
mock_get_user,
|
||||||
# mock_verify_password):
|
mock_verify_password):
|
||||||
# with app_.test_request_context():
|
with app_.test_request_context():
|
||||||
# with app_.test_client() as client:
|
with app_.test_client() as client:
|
||||||
# client.login(api_user_active)
|
client.login(api_user_active)
|
||||||
# with client.session_transaction() as session:
|
with client.session_transaction() as session:
|
||||||
# session['new-email'] = 'new_notify@notify.gov.uk'
|
session['new-email'] = 'new_notify@notify.gov.uk'
|
||||||
# response = client.get(url_for('main.user_profile_email_authenticate'))
|
response = client.get(url_for('main.user_profile_email_authenticate'))
|
||||||
|
|
||||||
# assert 'Change your email address' in response.get_data(as_text=True)
|
assert 'Change your email address' in response.get_data(as_text=True)
|
||||||
# assert 'Confirm' in response.get_data(as_text=True)
|
assert 'Confirm' in response.get_data(as_text=True)
|
||||||
# assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
|
|
||||||
def test_should_redirect_after_email_change_confirm(app_,
|
def test_should_redirect_after_email_change_confirm(app_,
|
||||||
|
|||||||
Reference in New Issue
Block a user