def test_copy_center_must_remain_copy_center(self): """test that a copy center can't be made into a non-copy center""" original_center = RegistrationCenterFactory() copy_center = RegistrationCenterFactory(copy_of=original_center) copy_center.copy_of = None with self.assertRaises(ValidationError) as cm: copy_center.clean() self.assertEqual(force_text(cm.exception.message), 'Copy centres are read-only.')
def test_copy_registration_center(self): """test that people can't register against a copy center""" copy_center = RegistrationCenterFactory() copy_center.copy_of = self.center copy_center.save() # try to register result = process_registration_request( center_id=copy_center.center_id, national_id=self.citizen.national_id, sms=self.sms ) self.assertEqual(result.message_code, constants.RESPONSE_CENTER_ID_INVALID)
def test_noncopy_center_cannot_become_copy_center(self): """test that a non-copy center can't be made into a copy center""" original_center = RegistrationCenterFactory() copy_center = RegistrationCenterFactory() copy_center.copy_of = original_center copy_center.center_type = RegistrationCenter.Types.COPY with self.assertRaises(ValidationError) as cm: copy_center.clean() self.assertEqual(force_text(cm.exception.message), 'A centre may not be changed to a copy centre.')
def test_copy_registration_center(self): """test that people can't register against a copy center""" copy_center = RegistrationCenterFactory() copy_center.copy_of = self.center copy_center.save() # try to register result = process_registration_request( center_id=copy_center.center_id, national_id=self.citizen.national_id, sms=self.sms) self.assertEqual(result.message_code, constants.RESPONSE_CENTER_ID_INVALID)