Esempio n. 1
0
    def setUp(self):
        subconstituency_name = os.environ.get('ROLLGEN_TEST_SUBCONSTITUENCY_NAME', '')
        subconstituency_name = subconstituency_name.decode('utf-8')

        if not subconstituency_name:
            subconstituency_name = generate_arabic_place_name()

        center_name = os.environ.get('ROLLGEN_TEST_CENTER_NAME', '')
        center_name = center_name.decode('utf-8')

        if not center_name:
            center_name = generate_arabic_place_name()

        subconstituency = SubConstituencyFactory(name_arabic=subconstituency_name)

        self.center = RegistrationCenterFactory(subconstituency=subconstituency, name=center_name)

        # For the center that has copies, I give it the max number of copies possible in order
        # to force the 'copied by' string to be as long as possible to reveal any line wrapping
        # problems that result.
        self.original_center = RegistrationCenterFactory()
        self.copy_centers = RegistrationCenterFactory.create_batch(settings.N_MAX_COPY_CENTERS,
                                                                   copy_of=self.original_center)

        self.election = ElectionFactory()
Esempio n. 2
0
 def test_copied_by_multiple(self):
     """Exercise build_copy_info() for a center that has multiple copies"""
     original = RegistrationCenterFactory()
     copy_centers = RegistrationCenterFactory.create_batch(3, copy_of=original)
     copy_center_ids = sorted([center.center_id for center in copy_centers])
     copy_center_ids = (ARABIC_COMMA + ' ').join(map(str, copy_center_ids))
     expected = '{}: {}'.format(STRINGS['copied_by_plural'], copy_center_ids)
     self.assertEqual(build_copy_info(original), expected)
Esempio n. 3
0
 def test_copied_by_multiple(self):
     """Exercise build_copy_info() for a center that has multiple copies"""
     original = RegistrationCenterFactory()
     copy_centers = RegistrationCenterFactory.create_batch(3,
                                                           copy_of=original)
     copy_center_ids = sorted([center.center_id for center in copy_centers])
     copy_center_ids = (ARABIC_COMMA + ' ').join(map(str, copy_center_ids))
     expected = '{}: {}'.format(STRINGS['copied_by_plural'],
                                copy_center_ids)
     self.assertEqual(build_copy_info(original), expected)