def test_copy_read_only(self): """test that copy centers are uneditable once created.""" copy_center = RegistrationCenterFactory(center_type=RegistrationCenter.Types.COPY) with self.assertRaises(ValidationError) as cm: copy_center.clean() self.assertEqual(force_text(cm.exception.message), 'Copy centres are read-only.')
def test_copy_read_only(self): """test that copy centers are uneditable once created.""" copy_center = RegistrationCenterFactory( center_type=RegistrationCenter.Types.COPY) with self.assertRaises(ValidationError) as cm: copy_center.clean() self.assertEqual(force_text(cm.exception.message), 'Copy centres are read-only.')
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_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_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_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.')