Remove the counties and unitary authorities library

It’s been superceded by the ‘Local’ library (formerly ‘Electoral wards
in the United Kingdom’).

The latter is better because:
- it’s covers all 4 nations, not just England and Wales
- it has electoral wards as well as local authorities which group them,
  so there’s more flexibility when choosing an area to broadcast to
This commit is contained in:
Chris Hill-Scott
2020-08-13 12:27:55 +01:00
parent be16c0187f
commit 72f5dcb91f
4 changed files with 10 additions and 32 deletions

View File

@@ -70,7 +70,6 @@ repo.create_tables()
simple_datasets = [ simple_datasets = [
("Countries", "ctry19cd", "ctry19nm"), ("Countries", "ctry19cd", "ctry19nm"),
("Counties and Unitary Authorities in England and Wales", "ctyua16cd", "ctyua16nm"),
] ]
for dataset_name, id_field, name_field in simple_datasets: for dataset_name, id_field, name_field in simple_datasets:
filepath = package_path / "{}.geojson".format(dataset_name) filepath = package_path / "{}.geojson".format(dataset_name)

View File

@@ -10,11 +10,6 @@ def test_loads_libraries():
assert [ assert [
(library.id, library.name, library.is_group) for library in sorted(broadcast_area_libraries) (library.id, library.name, library.is_group) for library in sorted(broadcast_area_libraries)
] == [ ] == [
(
'ctyua16',
'Counties and Unitary Authorities in England and Wales',
False,
),
( (
'ctry19', 'ctry19',
'Countries', 'Countries',
@@ -45,14 +40,7 @@ def test_examples():
countries = broadcast_area_libraries.get('ctry19').get_examples() countries = broadcast_area_libraries.get('ctry19').get_examples()
assert countries == 'England, Northern Ireland, Scotland, and Wales' assert countries == 'England, Northern Ireland, Scotland, and Wales'
counties = broadcast_area_libraries.get( wards = broadcast_area_libraries.get('wd20-lad20').get_examples()
'ctyua16',
).get_examples()
assert counties == 'Barking and Dagenham, Barnet, Barnsley, and 170 more…'
wards = broadcast_area_libraries.get(
'wd20-lad20',
).get_examples()
assert wards == 'Aberdeen City, Aberdeenshire, Adur, and 375 more…' assert wards == 'Aberdeen City, Aberdeenshire, Adur, and 375 more…'
@@ -76,11 +64,9 @@ def test_get_names_of_areas():
'ctry19-W92000004', 'ctry19-W92000004',
'lad20-W06000014', 'lad20-W06000014',
'ctry19-E92000001', 'ctry19-E92000001',
'ctyua16-E10000012',
) )
assert [area.name for area in sorted(areas)] == [ assert [area.name for area in sorted(areas)] == [
'England', 'Essex', 'Vale of Glamorgan', 'Wales', 'England', 'Vale of Glamorgan', 'Wales',
] ]
@@ -88,18 +74,14 @@ def test_get_areas_accepts_lists():
areas_from_list = broadcast_area_libraries.get_areas( areas_from_list = broadcast_area_libraries.get_areas(
[ [
'ctry19-W92000004', 'ctry19-W92000004',
'ctyua16-W06000014',
'ctry19-E92000001', 'ctry19-E92000001',
'ctyua16-E10000012',
] ]
) )
areas_from_args = broadcast_area_libraries.get_areas( areas_from_args = broadcast_area_libraries.get_areas(
'ctry19-W92000004', 'ctry19-W92000004',
'ctyua16-W06000014',
'ctry19-E92000001', 'ctry19-E92000001',
'ctyua16-E10000012',
) )
assert len(areas_from_args) == len(areas_from_list) == 4 assert len(areas_from_args) == len(areas_from_list) == 2
assert areas_from_args == areas_from_list assert areas_from_args == areas_from_list
@@ -180,9 +162,8 @@ def test_repository_has_all_libraries():
repo = BroadcastAreasRepository() repo = BroadcastAreasRepository()
libraries = repo.get_libraries() libraries = repo.get_libraries()
assert len(libraries) == 3 assert len(libraries) == 2
assert [ assert [
'Counties and Unitary Authorities in England and Wales',
'Countries', 'Countries',
'Local authorities', 'Local authorities',
] == sorted([name for _, name, _is_group in libraries]) ] == [name for _, name, _is_group in libraries]

View File

@@ -287,17 +287,15 @@ def test_choose_broadcast_library_page(
broadcast_message_id=fake_uuid, broadcast_message_id=fake_uuid,
) )
titles = [ assert [
normalize_spaces(title.text) normalize_spaces(title.text)
for title in page.select('.file-list-filename-large') for title in page.select('.file-list-filename-large')
] ] == [
assert sorted(titles) == sorted([
'Counties and Unitary Authorities in England and Wales',
'Countries', 'Countries',
'Local authorities', 'Local authorities',
]) ]
assert normalize_spaces(page.select('.file-list-hint-large')[1].text) == ( assert normalize_spaces(page.select('.file-list-hint-large')[0].text) == (
'England, Northern Ireland, Scotland, and Wales' 'England, Northern Ireland, Scotland, and Wales'
) )
@@ -305,7 +303,7 @@ def test_choose_broadcast_library_page(
'.choose_broadcast_area', '.choose_broadcast_area',
service_id=SERVICE_ONE_ID, service_id=SERVICE_ONE_ID,
broadcast_message_id=fake_uuid, broadcast_message_id=fake_uuid,
library_slug='ctyua16', library_slug='ctry19',
) )