Manage user pages now surfaces invited users

fetched from api.
This commit is contained in:
Adam Shimali
2016-02-26 15:33:17 +00:00
parent 9730db0e89
commit c76717942f
6 changed files with 57 additions and 15 deletions

View File

@@ -1,13 +1,15 @@
import json
from flask import url_for
from bs4 import BeautifulSoup
def test_should_show_overview_page(
app_,
api_user_active,
mock_login,
mock_get_service,
mock_get_users_by_service
mock_get_users_by_service,
mock_get_invites_for_service
):
with app_.test_request_context():
with app_.test_client() as client:
@@ -38,7 +40,8 @@ def test_redirect_after_saving_user(
api_user_active,
mock_login,
mock_get_service,
mock_get_users_by_service
mock_get_users_by_service,
mock_get_invites_for_service
):
with app_.test_request_context():
with app_.test_client() as client:
@@ -74,7 +77,8 @@ def test_invite_user(
api_user_active,
mock_login,
mock_get_users_by_service,
mock_create_invite
mock_create_invite,
mock_get_invites_for_service
):
from_user = api_user_active.id
service_id = service_one['id']
@@ -90,5 +94,9 @@ def test_invite_user(
)
assert response.status_code == 200
assert 'Invite sent to test@example.gov.uk' in response.get_data(as_text=True)
mock_create_invite.assert_called_with(from_user, service_id, email_address)
mock_get_invites_for_service.assert_called_with(service_id=service_id)
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.h1.string.strip() == 'Manage team'
flash_banner = page.find('div', class_='banner-default-with-tick').string.strip()
assert flash_banner == 'Invite sent to test@example.gov.uk'