def _create(cls, model_class, *args, **kwargs): from course_discovery.apps.course_metadata.tests.utils import build_salesforce_exception try: return super()._create(model_class, *args, **kwargs) except requests.ConnectionError: # raise user friendly suggestion to use factory with muted signals raise ConnectionError( build_salesforce_exception(model_class.__name__))
def test_build_salesforce_exception(self, record_type): expected = 'The Partner of this {record_type} has a Salesforce Configuration, ' \ 'try using {record_type}FactoryNoSignals instead.'.format(record_type=record_type) assert build_salesforce_exception(record_type) == expected