mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-24 09:58:43 -04:00
Merge pull request #2073 from alphagov/back-to-only-authed
Only show ‘back to service name’ link if signed in
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
{% block fullwidth_content %}
|
||||
<div id="content">
|
||||
{% if current_service %}
|
||||
{% if current_service and current_user.is_authenticated %}
|
||||
<div class="navigation-service">
|
||||
<a href="{{ url_for('main.show_accounts_or_dashboard') }}">Back to {{ current_service.name }}</a>
|
||||
</div>
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import pytest
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import url_for
|
||||
|
||||
from tests.conftest import normalize_spaces
|
||||
from tests.conftest import SERVICE_ONE_ID, normalize_spaces
|
||||
|
||||
SAMPLE_DATA = {
|
||||
'organisations': [
|
||||
@@ -123,3 +124,16 @@ def test_choose_account_should_not_show_back_to_service_link_if_no_service_in_se
|
||||
page = client_request.get('main.choose_account')
|
||||
|
||||
assert len(page.select('.navigation-service a')) == 0
|
||||
|
||||
|
||||
def test_choose_account_should_not_show_back_to_service_link_if_not_signed_in(
|
||||
client,
|
||||
mock_get_service,
|
||||
):
|
||||
with client.session_transaction() as session:
|
||||
session['service_id'] = SERVICE_ONE_ID
|
||||
response = client.get(url_for('main.sign_in'))
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
|
||||
assert page.select_one('h1').text == 'Sign in' # We’re not signed in
|
||||
assert page.select_one('.navigation-service a') is None
|
||||
|
||||
Reference in New Issue
Block a user