mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-01 06:30:56 -04:00
Put template ID on the single template page
Not necessary to have it on its own page – it’s one line of stuff. And definitely not as frequent use as the ‘Upload recipients’ or ‘Send yourself a test’ links.
This commit is contained in:
@@ -190,19 +190,6 @@ def send_test(service_id, template_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<service_id>/send/<template_id>/from-api", methods=['GET'])
|
||||
@login_required
|
||||
def send_from_api(service_id, template_id):
|
||||
return render_template(
|
||||
'views/send-from-api.html',
|
||||
template=get_template(
|
||||
service_api_client.get_service_template(service_id, template_id)['data'],
|
||||
current_service,
|
||||
letter_preview_url=url_for('.view_template', service_id=service_id, template_id=template_id)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def _check_messages(service_id, template_type, upload_id, letters_as_pdf=False):
|
||||
|
||||
if not session.get('upload_data'):
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/api-key.html" import api_key %}
|
||||
|
||||
{% block service_page_title %}
|
||||
API info
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<h1 class="heading-large">
|
||||
API info
|
||||
</h1>
|
||||
|
||||
{{ template|string }}
|
||||
|
||||
<div class="bottom-gutter">
|
||||
{{ api_key(template.id, name="Template ID", thing='template ID') }}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,6 +1,7 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/page-footer.html" import page_footer %}
|
||||
{% from "components/textbox.html" import textbox %}
|
||||
{% from "components/api-key.html" import api_key %}
|
||||
|
||||
{% block service_page_title %}
|
||||
{{ template.name }}
|
||||
@@ -17,6 +18,10 @@
|
||||
{% endwith %}
|
||||
</div>
|
||||
|
||||
<div class="bottom-gutter-2">
|
||||
{{ api_key(template.id, name="Template ID", thing='template ID') }}
|
||||
</div>
|
||||
|
||||
{{ page_footer(
|
||||
secondary_link=url_for('.choose_template', service_id=current_service.id),
|
||||
secondary_link_text='All templates'
|
||||
|
||||
@@ -316,25 +316,6 @@ def test_send_test_sms_message_with_placeholders(
|
||||
mock_s3_upload.assert_called_with(fake_uuid, expected_data, 'eu-west-1')
|
||||
|
||||
|
||||
def test_api_info_page(
|
||||
logged_in_client,
|
||||
mocker,
|
||||
api_user_active,
|
||||
mock_login,
|
||||
mock_get_service,
|
||||
mock_get_service_email_template,
|
||||
mock_s3_upload,
|
||||
mock_has_permissions,
|
||||
fake_uuid
|
||||
):
|
||||
response = logged_in_client.get(
|
||||
url_for('main.send_from_api', service_id=fake_uuid, template_id=fake_uuid),
|
||||
follow_redirects=True
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert 'API info' in response.get_data(as_text=True)
|
||||
|
||||
|
||||
def test_download_example_csv(
|
||||
logged_in_client,
|
||||
mocker,
|
||||
|
||||
@@ -84,6 +84,24 @@ def test_should_be_able_to_view_a_template_with_links(
|
||||
)
|
||||
|
||||
|
||||
def test_should_show_template_id_on_template_page(
|
||||
logged_in_client,
|
||||
mock_get_service_template,
|
||||
service_one,
|
||||
fake_uuid,
|
||||
):
|
||||
|
||||
response = logged_in_client.get(url_for(
|
||||
'.view_template',
|
||||
service_id=service_one['id'],
|
||||
template_id=fake_uuid))
|
||||
|
||||
assert response.status_code == 200
|
||||
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert page.select('.api-key-key')[0].text == fake_uuid
|
||||
|
||||
|
||||
def test_should_show_sms_template_with_downgraded_unicode_characters(
|
||||
logged_in_client,
|
||||
mocker,
|
||||
@@ -566,7 +584,6 @@ def test_should_show_page_for_a_deleted_template(
|
||||
content = response.get_data(as_text=True)
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
assert url_for("main.edit_service_template", service_id=fake_uuid, template_id=fake_uuid) not in content
|
||||
assert url_for("main.send_from_api", service_id=fake_uuid, template_id=fake_uuid) not in content
|
||||
assert url_for("main.send_test", service_id=fake_uuid, template_id=fake_uuid) not in content
|
||||
assert page.select('p.hint')[0].text.strip() == 'This template was deleted today at 3:00pm.'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user