mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-27 17:39:51 -04:00
Merge branch 'master' into platform-admin
Conflicts: tests/app/main/views/test_dashboard.py
This commit is contained in:
@@ -88,3 +88,23 @@ td {
|
||||
.heading-xlarge {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
#footer {
|
||||
|
||||
.footer-categories {
|
||||
|
||||
@extend %site-width-container;
|
||||
|
||||
&-wrapper {
|
||||
padding: 0 0 $gutter * 2;
|
||||
margin: 0 0 $gutter;
|
||||
border-bottom: 1px solid $border-colour;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin: 0 0 $gutter-two-thirds;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,10 +6,9 @@ from app import api_key_api_client
|
||||
from app.utils import user_has_permissions
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/documentation")
|
||||
@login_required
|
||||
def documentation(service_id):
|
||||
return render_template('views/documentation.html', service_id=service_id)
|
||||
@main.route("/documentation")
|
||||
def documentation():
|
||||
return render_template('views/documentation.html')
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/api-keys")
|
||||
|
||||
@@ -41,4 +41,7 @@ def check_and_resend_verification_code():
|
||||
# TODO there needs to be a way to generate a new session id
|
||||
user = user_api_client.get_user_by_email(session['user_details']['email'])
|
||||
user_api_client.send_verify_code(user.id, 'sms', user.mobile_number)
|
||||
return redirect(url_for('main.two_factor'))
|
||||
if user.state == 'pending':
|
||||
return redirect(url_for('main.verify'))
|
||||
else:
|
||||
return redirect(url_for('main.two_factor'))
|
||||
|
||||
@@ -16,6 +16,7 @@ from app.main.forms import TwoFactorForm
|
||||
@main.route('/two-factor', methods=['GET', 'POST'])
|
||||
def two_factor():
|
||||
# TODO handle user_email not in session
|
||||
|
||||
try:
|
||||
user_id = session['user_details']['id']
|
||||
except KeyError:
|
||||
|
||||
@@ -72,10 +72,31 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer_top %}
|
||||
<div class="footer-categories">
|
||||
<div class="footer-categories-wrapper">
|
||||
<div class="grid-row">
|
||||
<div class="column-one-third">
|
||||
<h2>Contact</h2>
|
||||
<ul>
|
||||
<li><a href="https://docs.google.com/forms/d/1AL8U-xJX_HAFEiQiJszGQw0PcEaEUnYATSntEghNDGo/viewform">Support and feedback</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
<h2>About</h2>
|
||||
<a href="{{ url_for("main.help") }}">Help</a>
|
||||
</div>
|
||||
<div class="column-one-third">
|
||||
<h2>Developers</h2>
|
||||
<a href="{{ url_for('main.documentation') }}">API documentation</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer_support_links %}
|
||||
<nav class="footer-nav">
|
||||
<a href="{{ url_for("main.help") }}">Help</a>
|
||||
<a href="https://docs.google.com/forms/d/1AL8U-xJX_HAFEiQiJszGQw0PcEaEUnYATSntEghNDGo/viewform">Support and feedback</a>
|
||||
<a href="{{ url_for("main.cookies") }}">Cookies</a>
|
||||
Built by the <a href="https://www.gov.uk/government/organisations/government-digital-service">Government Digital Service</a>
|
||||
</nav>
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
{% if current_user.has_permissions(['manage_api_keys', 'access_developer_docs']) %}
|
||||
<ul>
|
||||
<li><a href="{{ url_for('.api_keys', service_id=service_id) }}">API keys</a></li>
|
||||
<li><a href="{{ url_for('.documentation', service_id=service_id) }}">Developer documentation</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% extends "withoutnav_template.html" %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/api-key.html" import api_key %}
|
||||
|
||||
{% block page_title %}
|
||||
Developer documentation – GOV.UK Notify
|
||||
API documentation – GOV.UK Notify
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">
|
||||
Set up API integration
|
||||
Developer documentation
|
||||
</h1>
|
||||
|
||||
<div class="grid-row">
|
||||
@@ -81,7 +81,7 @@
|
||||
{{
|
||||
"""
|
||||
{
|
||||
'to': '+441234123123',
|
||||
'to': '+447700900404',
|
||||
'template': 1
|
||||
}
|
||||
"""|syntax_highlight_json
|
||||
@@ -164,10 +164,6 @@
|
||||
https://api.notify.works
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="{{ url_for('.api_keys', service_id=service_id) }}">API keys for your service</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
|
||||
<p>
|
||||
<a class="button" href="send-new-code" role="button">Resend verification code</a>
|
||||
<a class="button" href="{{url_for('main.check_and_resend_verification_code')}}" role="button">Resend verification code</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -97,10 +97,10 @@ def test_should_render_verification_code_not_received(app_,
|
||||
'speak to your service manager to reset the number.' in response.get_data(as_text=True)
|
||||
|
||||
|
||||
def test_check_and_redirect_to_two_factor(app_,
|
||||
api_user_active,
|
||||
mock_get_user_by_email,
|
||||
mock_send_verify_code):
|
||||
def test_check_and_redirect_to_two_factor_if_user_active(app_,
|
||||
api_user_active,
|
||||
mock_get_user_by_email,
|
||||
mock_send_verify_code):
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
with client.session_transaction() as session:
|
||||
@@ -112,6 +112,25 @@ def test_check_and_redirect_to_two_factor(app_,
|
||||
assert response.location == url_for('main.two_factor', _external=True)
|
||||
|
||||
|
||||
def test_check_and_redirect_to_verify_if_user_pending(app_,
|
||||
mocker,
|
||||
api_user_pending,
|
||||
mock_get_user_pending,
|
||||
mock_send_verify_code):
|
||||
|
||||
mocker.patch('app.user_api_client.get_user_by_email', return_value=api_user_pending)
|
||||
|
||||
with app_.test_request_context():
|
||||
with app_.test_client() as client:
|
||||
with client.session_transaction() as session:
|
||||
session['user_details'] = {
|
||||
'id': api_user_pending.id,
|
||||
'email': api_user_pending.email_address}
|
||||
response = client.get(url_for('main.check_and_resend_verification_code'))
|
||||
assert response.status_code == 302
|
||||
assert response.location == url_for('main.verify', _external=True)
|
||||
|
||||
|
||||
def test_should_create_new_code_for_user(app_,
|
||||
api_user_active,
|
||||
mock_get_user_by_email,
|
||||
|
||||
@@ -86,7 +86,6 @@ def test_menu_manage_service(mocker, app_, api_user_active, service_one, mock_ge
|
||||
assert url_for('main.service_settings', service_id=service_one['id']) in page
|
||||
|
||||
assert url_for('main.api_keys', service_id=service_one['id']) not in page
|
||||
assert url_for('main.documentation', service_id=service_one['id']) not in page
|
||||
|
||||
|
||||
def test_menu_manage_api_keys(mocker, app_, api_user_active, service_one, mock_get_service_templates, mock_get_jobs):
|
||||
@@ -111,7 +110,6 @@ def test_menu_manage_api_keys(mocker, app_, api_user_active, service_one, mock_g
|
||||
assert url_for('main.service_settings', service_id=service_one['id']) not in page
|
||||
|
||||
assert url_for('main.api_keys', service_id=service_one['id']) in page
|
||||
assert url_for('main.documentation', service_id=service_one['id']) in page
|
||||
|
||||
|
||||
def test_menu_all_services_for_platform_admin_user(mocker, app_, platform_admin_user, service_one,
|
||||
|
||||
Reference in New Issue
Block a user