def test_find_creates_external_system_if_not_found_and_create_is_true( self, ExternalSystem): ExternalSystem.DoesNotExist = Exception ExternalSystem.objects.get.side_effect = ExternalSystem.DoesNotExist ExternalSystemHelper.find('systemName', True) ExternalSystem.objects.create.assert_called_with( name='systemName', description='systemName')
def test_find_raises_error_if_external_system_not_found(self): with self.assertRaises(CommandError): ExternalSystemHelper.find('systemName', False)
def test_find_raises_error_if_external_system_name_is_blank(self): with self.assertRaises(CommandError): ExternalSystemHelper.find('')