Files
notifications-admin/tests/app/broadcast_areas/test_models.py
Ben Thorner f96b75b401 Add method to get wards for custom polygon
This will be used as part of the area aggregation in the following
commits.
2021-09-02 12:55:47 +01:00

21 lines
590 B
Python

import pytest
from app.broadcast_areas.models import CustomBroadcastArea
from tests.app.broadcast_areas.custom_polygons import BRISTOL, SANTA_A, SKYE
@pytest.mark.parametrize(('simple_polygon', 'expected_wards_length'), [
(SKYE, 2),
(BRISTOL, 12),
(SANTA_A, 0) # does not overlap with UK
])
def test_custom_broadcast_area_overlapping_electoral_wards(
simple_polygon,
expected_wards_length,
):
custom_area = CustomBroadcastArea(
name='foo', polygons=[simple_polygon]
)
assert len(custom_area.overlapping_electoral_wards) == expected_wards_length