mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-30 06:01:06 -04:00
Merge branch 'master' into clean-makefile
This commit is contained in:
@@ -9,6 +9,7 @@ class InviteApiClient(NotifyAdminAPIClient):
|
||||
|
||||
def init_app(self, app):
|
||||
self.base_url = app.config['API_HOST_NAME']
|
||||
self.admin_url = app.config['ADMIN_BASE_URL']
|
||||
self.service_id = app.config['ADMIN_CLIENT_USER_NAME']
|
||||
self.api_key = app.config['ADMIN_CLIENT_SECRET']
|
||||
|
||||
@@ -18,7 +19,8 @@ class InviteApiClient(NotifyAdminAPIClient):
|
||||
'email_address': email_address,
|
||||
'from_user': invite_from_id,
|
||||
'permissions': permissions,
|
||||
'auth_type': auth_type
|
||||
'auth_type': auth_type,
|
||||
'invite_link_host': self.admin_url,
|
||||
}
|
||||
data = _attach_current_user(data)
|
||||
resp = self.post(url='/service/{}/invite'.format(service_id), data=data)
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
</p>
|
||||
{% elif notifications %}
|
||||
<p class="bottom-gutter">
|
||||
<a href="{{ download_link }}" download="download" class="heading-small">Download this report</a>
|
||||
<a href="{{ download_link }}" download class="heading-small">Download this report</a>
|
||||
 
|
||||
<span id="time-left">{{ time_left }}</span>
|
||||
</p>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
{% if template.template_type != 'letter' or not request.args.from_test %}
|
||||
<input type="submit" class="button" value="Send {{ count_of_recipients }} {{ message_count_label(count_of_recipients, template.template_type, suffix='') }}" />
|
||||
{% else %}
|
||||
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download="download" class="button">Download as a printable PDF</a>
|
||||
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a printable PDF</a>
|
||||
{% endif %}
|
||||
<a href="{{ back_link }}" class="page-footer-back-link">Back</a>
|
||||
</form>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<div class="ajax-block-container">
|
||||
{% if messages %}
|
||||
<p class="bottom-gutter-2-3 top-gutter-2-3">
|
||||
<a href="{{ url_for('.inbox_download', service_id=current_service.id) }}" download="download" class="heading-small">Download these messages</a>
|
||||
<a href="{{ url_for('.inbox_download', service_id=current_service.id) }}" download class="heading-small">Download these messages</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% call(item, row_number) list_table(
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
{% if template.template_type != 'letter' or not request.args.from_test %}
|
||||
<input type="submit" class="button" value="Send 1 {{ message_count_label(1, template.template_type, suffix='') }}" />
|
||||
{% else %}
|
||||
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download="download" class="button">Download as a printable PDF</a>
|
||||
<a href="{{ url_for('main.check_messages_preview', service_id=current_service.id, template_type=template.template_type, upload_id=upload_id, filetype='pdf') }}" download class="button">Download as a printable PDF</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<a href="{{ back_link }}" class="page-footer-back-link">Back</a>
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
Estimated delivery date: {{ estimated_letter_delivery_date|string|format_date_short }}
|
||||
</p>
|
||||
<p class="bottom-gutter">
|
||||
<a href="{{ url_for('main.view_letter_notification_as_preview', service_id=current_service.id, notification_id=notification_id, filetype='pdf') }}" download="download">Download as a PDF</a>
|
||||
<a href="{{ url_for('main.view_letter_notification_as_preview', service_id=current_service.id, notification_id=notification_id, filetype='pdf') }}" download>Download as a PDF</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
{% endcall %}
|
||||
</div>
|
||||
<p class="table-show-more-link">
|
||||
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}">Download this example</a>
|
||||
<a href="{{ url_for('.get_example_csv', service_id=current_service.id, template_id=template.id) }}" download>Download this example</a>
|
||||
</p>
|
||||
|
||||
<h2 class="heading-medium">Your file will populate this template ({{ template.name }})</h2>
|
||||
|
||||
@@ -20,4 +20,4 @@ notifications-python-client==4.7.1
|
||||
awscli==1.14.16
|
||||
awscli-cwlogs>=1.4,<1.5
|
||||
|
||||
git+https://github.com/alphagov/notifications-utils.git@23.3.5#egg=notifications-utils==23.3.5
|
||||
git+https://github.com/alphagov/notifications-utils.git@23.4.0#egg=notifications-utils==23.4.0
|
||||
|
||||
@@ -97,7 +97,7 @@ def test_should_show_page_for_one_job(
|
||||
job_id=fake_uuid,
|
||||
status=status_argument,
|
||||
)
|
||||
csv_link = page.find('a', {'download': 'download'})
|
||||
csv_link = page.select_one('a[download]')
|
||||
assert csv_link['href'] == url_for(
|
||||
'main.view_job_csv',
|
||||
service_id=service_one['id'],
|
||||
|
||||
@@ -1,4 +1,40 @@
|
||||
from app.notify_client.invite_api_client import InviteApiClient
|
||||
from unittest.mock import ANY
|
||||
from app import invite_api_client
|
||||
|
||||
|
||||
def test_client_creates_invite(
|
||||
app_,
|
||||
mocker,
|
||||
fake_uuid,
|
||||
sample_invite,
|
||||
):
|
||||
|
||||
mocker.patch('app.notify_client.current_user')
|
||||
|
||||
mock_post = mocker.patch(
|
||||
'app.invite_api_client.post',
|
||||
return_value={'data': dict.fromkeys({
|
||||
'id', 'service', 'from_user', 'email_address',
|
||||
'permissions', 'status', 'created_at', 'auth_type'
|
||||
})}
|
||||
)
|
||||
|
||||
invite_api_client.create_invite(
|
||||
'12345', '67890', 'test@example.com', 'send_messages', 'sms_auth'
|
||||
)
|
||||
|
||||
mock_post.assert_called_once_with(
|
||||
url='/service/{}/invite'.format('67890'),
|
||||
data={
|
||||
'auth_type': 'sms_auth',
|
||||
'email_address': 'test@example.com',
|
||||
'from_user': '12345',
|
||||
'service': '67890',
|
||||
'created_by': ANY,
|
||||
'permissions': 'send_messages',
|
||||
'invite_link_host': 'http://localhost:6012',
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def test_client_returns_invite(mocker, sample_invite):
|
||||
@@ -10,10 +46,9 @@ def test_client_returns_invite(mocker, sample_invite):
|
||||
|
||||
expected_url = '/service/{}/invite'.format(service_id)
|
||||
|
||||
client = InviteApiClient()
|
||||
mock_get = mocker.patch('app.notify_client.invite_api_client.InviteApiClient.get', return_value=expected_data)
|
||||
|
||||
invites = client.get_invites_for_service(service_id)
|
||||
invites = invite_api_client.get_invites_for_service(service_id)
|
||||
|
||||
mock_get.assert_called_once_with(expected_url)
|
||||
assert len(invites) == 1
|
||||
|
||||
Reference in New Issue
Block a user