def test_make_addresses_for_postcode(self): # Before the fix, we wrongly assume that we know the polling station postcode = 'KW15 88TF' rh = RoutingHelper(postcode) endpoint = rh.get_endpoint() self.assertEqual('postcode_view', endpoint.view) # Fix the addresses outside of the districts make_addresses_for_postcode(postcode, council_id="X01000001") # Now we should get offered an address lookup rh = RoutingHelper(postcode) endpoint = rh.get_endpoint() self.assertEqual('address_select_view', endpoint.view)
def test_make_addresses_cross_boarders(self): """ Ensure that we make addresses for both sides of a district. We should see 2 ResidentialAddress after calling make_addresses_for_postcode. """ # We don't have any addresses yet self.assertEqual(ResidentialAddress.objects.all().count(), 0) # Fix the addresses outside of the districts postcode = 'KW15 88TF' make_addresses_for_postcode(postcode, council_id="X01000001") self.assertEqual(ResidentialAddress.objects.all().count(), 2)