mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
Add pages to invite, edit, and delete users
This takes the original prototype version of this page, and, using the same fake data (ie nothing is wired up): - adds an invite users page - adds an edit (and delete) user page Both these pages allow the user to set another user’s permissions. This commit adds images for the ticks and crosses, so we have control over their appearance.
This commit is contained in:
87
tests/app/main/views/test_manage_users.py
Normal file
87
tests/app/main/views/test_manage_users.py
Normal file
@@ -0,0 +1,87 @@
|
||||
import json
|
||||
from flask import url_for
|
||||
|
||||
|
||||
def test_should_show_overview_page(
|
||||
app_,
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
response = client.get(url_for('main.manage_users', service_id=55555))
|
||||
|
||||
assert 'Manage team' in response.get_data(as_text=True)
|
||||
assert 'Henry Hadlow' in response.get_data(as_text=True)
|
||||
assert 'caley.smolska' in response.get_data(as_text=True)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_should_show_page_for_one_user(
|
||||
app_,
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
response = client.get(url_for('main.edit_user', service_id=55555, user_id=0))
|
||||
|
||||
assert 'Henry Hadlow' in response.get_data(as_text=True)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_redirect_after_saving_user(
|
||||
app_,
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
response = client.post(url_for(
|
||||
'main.edit_user', service_id=55555, user_id=0
|
||||
))
|
||||
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for(
|
||||
'main.manage_users', service_id=55555, _external=True
|
||||
)
|
||||
|
||||
|
||||
def test_should_show_page_for_inviting_user(
|
||||
app_,
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
response = client.get(url_for('main.invite_user', service_id=55555))
|
||||
|
||||
assert 'Add a new team member' in response.get_data(as_text=True)
|
||||
assert response.status_code == 200
|
||||
|
||||
|
||||
def test_invite_user(
|
||||
app_,
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service
|
||||
):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
client.login(api_user_active)
|
||||
response = client.post(
|
||||
url_for('main.invite_user', service_id=55555),
|
||||
data={'email_address': 'test@example.gov.uk'},
|
||||
follow_redirects=True
|
||||
)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert 'Invite sent to test@example.gov.uk' in response.get_data(as_text=True)
|
||||
Reference in New Issue
Block a user