from django.test import TestCase

from home.geo.zambia_geo import zambia_districts, zambia_region_entries


class ZambiaGeoDataTests(TestCase):
    def test_all_provinces_present(self):
        names = {entry['name'] for entry in zambia_region_entries()}
        self.assertEqual(
            names,
            {
                'Central Province',
                'Copperbelt Province',
                'Eastern Province',
                'Luapula Province',
                'Lusaka Province',
                'Muchinga Province',
                'Northern Province',
                'North-Western Province',
                'Southern Province',
                'Western Province',
            },
        )

    def test_copperbelt_districts_include_ndola(self):
        districts = zambia_districts()['Copperbelt Province']
        self.assertIn('Ndola', districts)
        self.assertIn('Kitwe', districts)

    def test_total_district_count(self):
        total = sum(len(items) for items in zambia_districts().values())
        self.assertEqual(total, 118)
