mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Merge pull request #2628 from alphagov/hide-postage-for-those-who-cant-choose
Don’t show postage to users who can’t choose it
This commit is contained in:
@@ -21,13 +21,12 @@
|
|||||||
Send
|
Send
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="column-whole">
|
{% if current_service.has_permission("choose_postage") %}
|
||||||
{% if current_service.has_permission("choose_postage") and template_postage %}
|
<div class="column-whole" id="postage">
|
||||||
<h2 class="heading-small heading-inline">Postage</h2>: {{ template_postage }} class
|
<h2 class="heading-small heading-inline">Postage</h2>:
|
||||||
{% elif (current_service.has_permission("choose_postage") and not template_postage) or not current_service.has_permission("choose_postage") %}
|
{{ template_postage or current_service.postage }} class
|
||||||
<h2 class="heading-small heading-inline">Postage</h2>: {{ current_service.postage }} class
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if current_user.has_permissions('send_messages', restrict_admin_usage=True) %}
|
{% if current_user.has_permissions('send_messages', restrict_admin_usage=True) %}
|
||||||
|
|||||||
@@ -403,9 +403,13 @@ def test_user_with_only_send_and_view_sees_letter_page(
|
|||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("permissions,template_postage,expected_result", [
|
@pytest.mark.parametrize("permissions,template_postage,expected_result", [
|
||||||
(["choose_postage", "letter"], "first", "first"),
|
(["choose_postage", "letter"], "first", "Postage: first class"),
|
||||||
(["choose_postage", "letter"], None, "second"),
|
(["choose_postage", "letter"], "second", "Postage: second class"),
|
||||||
(["letter"], "first", "second"),
|
(["choose_postage", "letter"], None, "Postage: second class"),
|
||||||
|
pytest.param(
|
||||||
|
["letter"], None, "Postage: second class",
|
||||||
|
marks=pytest.mark.xfail(raises=AttributeError)
|
||||||
|
),
|
||||||
])
|
])
|
||||||
def test_view_letter_template_displays_postage_dynamically_based_on_service_permissions_and_template_postage(
|
def test_view_letter_template_displays_postage_dynamically_based_on_service_permissions_and_template_postage(
|
||||||
client_request,
|
client_request,
|
||||||
@@ -431,7 +435,7 @@ def test_view_letter_template_displays_postage_dynamically_based_on_service_perm
|
|||||||
template_id=fake_uuid,
|
template_id=fake_uuid,
|
||||||
)
|
)
|
||||||
|
|
||||||
assert "Postage: {} class".format(expected_result) in page.text
|
assert normalize_spaces(page.select_one('#postage').text) == expected_result
|
||||||
|
|
||||||
|
|
||||||
def test_view_non_letter_template_does_not_display_postage(
|
def test_view_non_letter_template_does_not_display_postage(
|
||||||
|
|||||||
Reference in New Issue
Block a user