def teardown(self): cache.clear() for patch in self._patches: patch.stop() self._setting_override.__exit__(None, None, None)
def mock_retrieve_company_non_find_a_supplier(retrieve_profile_data): retrieve_profile_data['is_published_find_a_supplier'] = (False) patch = mock.patch.object(api_client.company, 'retrieve_public_profile', return_value=create_response( 200, retrieve_profile_data)) yield patch.start() patch.stop()
def mock_retrieve_supplier(): data = {'company': None} response = create_response(data) patch = mock.patch.object(api_client.supplier, 'retrieve_profile', return_value=response) yield patch.start() patch.stop()
def teardown(self): for conn, trans in self.transactions: transaction.set_rollback(True, using=conn) trans.__exit__(None, None, None) for patch in self._patches: patch.stop() self._setting_override.__exit__(None, None, None) cache.clear()
def mock_retrieve_company(): data = { 'name': 'Cool Company', 'is_publishable': True, 'expertise_products_services': {}, 'is_identity_check_message_sent': False, } response = create_response(data) patch = mock.patch.object(api_client.company, 'profile_retrieve', return_value=response) yield patch.start() patch.stop()
def _stop_patches(self): patches = self._current_patches.pop() for patch in patches: patch.stop()
def _stop_patches(self): if not self._current_patches: return patches = self._current_patches.pop() for patch in patches: patch.stop()
def tearDown(self): for patch in self._patches: patch.stop() cache.clear()