def test_registration_center_queries(self): rc1 = RegistrationCenterFactory(reg_open=True) rc2 = RegistrationCenterFactory(reg_open=False) for_registration = get_active_registration_locations() all_locations = get_all_polling_locations() self.assertEquals(sorted(for_registration.keys()), sorted([rc1.center_id])) self.assertEquals(sorted(all_locations.keys()), sorted([rc1.center_id, rc2.center_id]))
def setUp(self): self.original = RegistrationCenterFactory() self.copy = RegistrationCenterFactory(copy_of=self.original) self.polling_locations = get_all_polling_locations() self.election = ElectionFactory( polling_start_time=now() - datetime.timedelta(hours=1), polling_end_time=now() + datetime.timedelta(hours=1), ) # add decoy elections before/after the real one self.decoy_before_election = ElectionFactory( polling_start_time=self.election.polling_start_time - datetime.timedelta(days=5), polling_end_time=self.election.polling_end_time - datetime.timedelta(days=5), ) self.decoy_after_election = ElectionFactory( polling_start_time=self.election.polling_start_time + datetime.timedelta(days=5), polling_end_time=self.election.polling_end_time + datetime.timedelta(days=5), ) self.test_office_1 = 1 self.test_office_2 = 2 self.test_region = 3 self.polling_centers = { '11001': { 'polling_center_code': 11001, 'office_id': self.test_office_1, 'subconstituency_id': 2, 'region': Office.REGION_NAMES[self.test_region], 'country': 'Libya' }, '11002': { 'polling_center_code': 11002, 'office_id': self.test_office_2, 'subconstituency_id': 2, 'region': Office.REGION_NAMES[self.test_region], 'country': 'Libya' }, '11003': { 'polling_center_code': 11003, 'office_id': self.test_office_1, 'subconstituency_id': 2, 'region': Office.REGION_NAMES[self.test_region], 'country': 'Libya' } } self.center_opens = [] self.center_reports = [] self.inactive_for_election = ['11003']