def setUp(self):
# Cleanup
self.addCleanup(patch.stopall)
# Request patch
self.request = patch.object(module, 'request').start()
# Various patches
self.services = patch.object(module, 'services').start()
self.original_config = dict(module.config)
module.config['STORAGE_BUCKET_NAME'] = self.bucket = 'buckbuck'
module.config['STORAGE_ACCESS_KEY_ID'] = ''
module.config['STORAGE_SECRET_ACCESS_KEY'] = ''
module.config['ACCESS_KEY_EXPIRES_IN'] = ''
module.config['STORAGE_PATH_PATTERN'] = '{owner}/{dataset}/{path}'
self.s3 = boto3.client('s3')
python类stopall()的实例源码
test_copytool_monitor.py 文件源码
项目:intel-manager-for-lustre
作者: intel-hpdd
项目源码
文件源码
阅读 25
收藏 0
点赞 0
评论 0
def setUp(self):
super(CopytoolTestCase, self).setUp()
from chroma_agent.config_store import ConfigStore
self.mock_config = ConfigStore(tempfile.mkdtemp())
patch('chroma_agent.copytool_monitor.config', self.mock_config).start()
self.ct_id = '42'
self.ct_bin_path = '/usr/sbin/lhsmtool_foo'
self.ct_filesystem = 'testfs'
self.ct_mountpoint = '/mnt/testfs'
self.ct_archive = 2
self.ct_index = 0
self.ct = Copytool(self.ct_id, self.ct_index, self.ct_bin_path,
self.ct_archive, self.ct_filesystem,
self.ct_mountpoint, "")
self.addCleanup(patch.stopall)
def setUp(self):
super(PactSetupTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_requests = patch('requests.api.request').start()
self.target = Pact(self.consumer, self.provider)
(self.target
.given('I am creating a new pact using the Pact class')
.upon_receiving('a specific request to the server')
.with_request('GET', '/path')
.will_respond_with(200, body='success'))
self.delete_call = call('delete', 'http://localhost:1234/interactions',
headers={'X-Pact-Mock-Service': 'true'})
self.put_interactions_call = call(
'put', 'http://localhost:1234/interactions',
data=None,
headers={'X-Pact-Mock-Service': 'true'},
json={'interactions': [{
'response': {'status': 200, 'body': 'success'},
'request': {'path': '/path', 'method': 'GET'},
'description': 'a specific request to the server',
'provider_state': 'I am creating a new pact using the '
'Pact class'}]})
def setUp(self):
super(PactVerifyTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_requests = patch('requests.api.request').start()
self.target = Pact(self.consumer, self.provider)
(self.target
.given('I am creating a new pact using the Pact class')
.upon_receiving('a specific request to the server')
.with_request('GET', '/path')
.will_respond_with(200, body='success'))
self.get_verification_call = call(
'get', 'http://localhost:1234/interactions/verification',
allow_redirects=True,
headers={'X-Pact-Mock-Service': 'true'},
params=None)
self.post_publish_pacts_call = call(
'post', 'http://localhost:1234/pact',
data=None,
headers={'X-Pact-Mock-Service': 'true'},
json={'pact_dir': os.getcwd(),
'consumer': {'name': 'TestConsumer'},
'provider': {'name': 'TestProvider'}})
def tearDown(self):
unittest.TestCase.tearDown(self)
patch.stopall()
def tearDown(self):
patch.stopall()
def tearDown(self):
patch.stopall()
def tearDown(self):
patch.stopall()
def tearDown(self):
self.testbed.deactivate()
patch.stopall()
bigquery_table_streamer_test.py 文件源码
项目:gcp-census
作者: ocadotechnology
项目源码
文件源码
阅读 22
收藏 0
点赞 0
评论 0
def tearDown(self):
patch.stopall()
def tearDown(self):
self.testbed.deactivate()
patch.stopall()
def tearDown(self):
self.testbed.deactivate()
patch.stopall()
def setUp(self):
self.addCleanup(patch.stopall)
# Tests
def setUp(self):
self.echo_patch = patch.object(pyqubes.enact, 'echo').start()
self.call_patch = patch.object(pyqubes.enact, 'call').start()
self.addCleanup(patch.stopall)
def setUp(self):
self.enact_patch = patch.object(pyqubes.vm.VM, 'enact').start()
self.addCleanup(patch.stopall)
self.vm = pyqubes.vm.VM("bounding")
def setUp(self):
self.enter_patch = patch.object(pyqubes.vm.VM, 'firewall_open').start()
self.exit_patch = patch.object(pyqubes.vm.VM, 'firewall_close').start()
self.addCleanup(patch.stopall)
self.vm = pyqubes.vm.TemplateVM("magic")
def setUp(self):
self.enter_patch = patch.object(pyqubes.vm.VM, 'start').start()
self.exit_patch = patch.object(pyqubes.vm.VM, 'shutdown').start()
self.addCleanup(patch.stopall)
self.vm = pyqubes.vm.TemplateVM("magic")
def setUp(self):
self.enact_patch = patch.object(pyqubes.vm.VM, 'enact').start()
self.addCleanup(patch.stopall)
def setUp(self):
self.print_patch = patch.object(six, 'print_').start()
self.addCleanup(patch.stopall)
def _post_teardown(self):
"""
Disable all mocks after the test.
"""
if self.mock_requests:
responses.reset()
responses.stop()
patch.stopall()
def tearDown(self):
super(TestScope, self).tearDown()
patch.stopall()
def setUp(self):
self.addCleanup(patch.stopall)
self.controllers = patch.object(module, 'controllers').start()
# Tests
def setUp(self):
fill_db()
request = request_factory.post('')
request.session = SessionStore()
set_up_session(request.session)
cart = Cart(request)
mock_update = Mock(wraps=cart.update)
patch.object(cart, 'update', mock_update).start()
self.addCleanup(patch.stopall)
self.mock_update = mock_update
self.request = request
self.cart = cart
self.cart_session = request.session[SESSION_KEY]
test_copytool_monitor.py 文件源码
项目:intel-manager-for-lustre
作者: intel-hpdd
项目源码
文件源码
阅读 21
收藏 0
点赞 0
评论 0
def setUp(self):
super(CopytoolMonitorTestCase, self).setUp()
self.client = Mock()
self.copytool = Mock()
self.copytool.event_fifo = '/var/spool/test-fifo'
self.monitor = CopytoolMonitor(self.client, self.copytool)
self.addCleanup(patch.stopall)
def teardown_module(module):
"""Stop patches and enable logging output"""
patch.stopall()
logging.disable(logging.NOTSET)
def tearDown(self):
patch.stopall()
def tearDown(self):
patch.stopall()
def tearDown(self):
patch.stopall()
def tearDown(self):
patch.stopall()
def tearDown(self):
patch.stopall()