def teardown(self):
        cache.clear()

        for patch in self._patches:
            patch.stop()

        self._setting_override.__exit__(None, None, None)
Exemplo n.º 2
0
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()
Exemplo n.º 3
0
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()
Exemplo n.º 4
0
    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()
Exemplo n.º 5
0
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()
Exemplo n.º 6
0
 def _stop_patches(self):
     patches = self._current_patches.pop()
     for patch in patches:
         patch.stop()
Exemplo n.º 7
0
 def _stop_patches(self):
     if not self._current_patches:
         return
     patches = self._current_patches.pop()
     for patch in patches:
         patch.stop()
Exemplo n.º 8
0
 def tearDown(self):
     for patch in self._patches:
         patch.stop()
     cache.clear()
Exemplo n.º 9
0
 def _stop_patches(self):
     patches = self._current_patches.pop()
     for patch in patches:
         patch.stop()