diff --git a/app/templates/views/broadcast/libraries.html b/app/templates/views/broadcast/libraries.html index e029febd8..60ce83edc 100644 --- a/app/templates/views/broadcast/libraries.html +++ b/app/templates/views/broadcast/libraries.html @@ -15,7 +15,7 @@ {% for library in libraries|sort %} {{ library.name }} -
{{ library.examples }}
+{{ library.get_examples() }}
{% endfor %} {% endblock %} diff --git a/tests/app/main/views/test_broadcast.py b/tests/app/main/views/test_broadcast.py index 372d45dd9..511d516dc 100644 --- a/tests/app/main/views/test_broadcast.py +++ b/tests/app/main/views/test_broadcast.py @@ -1,7 +1,7 @@ import pytest from flask import url_for -from tests.conftest import SERVICE_ONE_ID +from tests.conftest import SERVICE_ONE_ID, normalize_spaces @pytest.mark.parametrize('endpoint, extra_args', ( @@ -85,10 +85,34 @@ def test_choose_broadcast_library_page( service_one, ): service_one['permissions'] += ['broadcast'] - client_request.get( + page = client_request.get( '.choose_broadcast_library', service_id=SERVICE_ONE_ID, ) + assert [ + (normalize_spaces(title.text), normalize_spaces(hint.text)) + for title, hint in list(zip( + page.select('.file-list-filename-large'), page.select('.file-list-hint-large') + )) + ] == [ + ( + 'Counties and Unitary Authorities in England and Wales', + 'Barking and Dagenham, Barnet, Barnsley and 171 more…', + ), + ( + 'Countries', + 'England, Northern Ireland, Scotland and Wales', + ), + ( + 'Regions of England', + 'East Midlands, East of England, London and 6 more…', + ), + ] + assert page.select_one('a.file-list-filename-large.govuk-link')['href'] == url_for( + '.choose_broadcast_area', + service_id=SERVICE_ONE_ID, + library_slug='counties-and-unitary-authorities-in-england-and-wales', + ) def test_choose_broadcast_area_page(