本文整理汇总了Python中tests.utils.run_server函数的典型用法代码示例。如果您正苦于以下问题:Python run_server函数的具体用法?Python run_server怎么用?Python run_server使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run_server函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUpModule
def setUpModule(func):
func.return_value = objectstore_loc
global test_server, model
patch_auth()
test_server = run_server(test_mode=False)
model = cherrypy.tree.apps['/plugins/kimchi'].root.model
示例2: setUpModule
def setUpModule():
global test_server, model, tmpfile
patch_auth()
tmpfile = tempfile.mktemp()
model = MockModel(tmpfile)
test_server = run_server(test_mode=True, model=model)
示例3: setUpModule
def setUpModule():
global test_server, model
patch_auth()
test_server = run_server(test_mode=True)
model = cherrypy.tree.apps['/plugins/kimchi'].root.model
iso_gen.construct_fake_iso(MOCK_ISO, True, '14.04', 'ubuntu')
示例4: setUpModule
def setUpModule():
global model, test_server, fake_iso
cherrypy.request.headers = {'Accept': 'application/json'}
patch_auth()
test_server = run_server(test_mode=True)
model = cherrypy.tree.apps['/plugins/kimchi'].root.model
fake_iso = '/tmp/fake.iso'
iso_gen.construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
示例5: setUpModule
def setUpModule():
global test_server, model, host, port, ssl_port
model = GingerModel()
host = '127.0.0.1'
port = get_free_port('http')
ssl_port = get_free_port('https')
test_server = run_server(host, port, ssl_port, test_mode=True, model=model)
示例6: setUpModule
def setUpModule():
global test_server, model
patch_auth()
test_server = run_server(test_mode=True)
model = cherrypy.tree.apps['/plugins/kimchi'].root.model
# Create fake ISO to do the tests
construct_fake_iso(fake_iso, True, '12.04', 'ubuntu')
示例7: setUpModule
def setUpModule():
global test_server, model, host, port, ssl_port
patch_auth(sudo=False)
model = mockmodel.MockModel('/tmp/obj-store-test')
host = '127.0.0.1'
port = get_free_port('http')
ssl_port = get_free_port('https')
test_server = run_server(host, port, ssl_port, test_mode=True, model=model)
示例8: test_vm_livemigrate_persistent_API
def test_vm_livemigrate_persistent_API(self):
patch_auth()
inst = model.Model(libvirt_uri='qemu:///system',
objstore_loc=self.tmp_store)
host = '127.0.0.1'
port = get_free_port('http')
ssl_port = get_free_port('https')
cherrypy_port = get_free_port('cherrypy_port')
with RollbackContext() as rollback:
test_server = run_server(host, port, ssl_port, test_mode=True,
cherrypy_port=cherrypy_port, model=inst)
rollback.prependDefer(test_server.stop)
self.request = partial(request, host, ssl_port)
self.create_vm_test()
rollback.prependDefer(rollback_wrapper, self.inst.vm_delete,
u'test_vm_migrate')
# removing cdrom because it is not shared storage and will make
# the migration fail
dev_list = self.inst.vmstorages_get_list('test_vm_migrate')
self.inst.vmstorage_delete('test_vm_migrate', dev_list[0])
try:
self.inst.vm_start('test_vm_migrate')
except Exception, e:
self.fail('Failed to start the vm, reason: %s' % e.message)
migrate_url = "/plugins/kimchi/vms/%s/migrate" % 'test_vm_migrate'
req = json.dumps({'remote_host': KIMCHI_LIVE_MIGRATION_TEST,
'user': 'root'})
resp = self.request(migrate_url, req, 'POST')
self.assertEquals(202, resp.status)
task = json.loads(resp.read())
wait_task(self._task_lookup, task['id'])
task = json.loads(
self.request(
'/plugins/kimchi/tasks/%s' % task['id'],
'{}'
).read()
)
self.assertEquals('finished', task['status'])
try:
remote_conn = self.get_remote_conn()
rollback.prependDefer(remote_conn.close)
remote_vm = remote_conn.lookupByName('test_vm_migrate')
self.assertTrue(remote_vm.isPersistent())
remote_vm.destroy()
remote_vm.undefine()
except Exception, e:
self.fail('Migration test failed: %s' % e.message)
示例9: setUpModule
def setUpModule():
global test_server, model
patch_auth(sudo=False)
model = mockmodel.MockModel("/tmp/obj-store-test")
test_server = run_server(test_mode=True, model=model)
# Create fake ISO to do the tests
construct_fake_iso(fake_iso, True, "12.04", "ubuntu")
示例10: setUpModule
def setUpModule():
global test_server, model, host, port, ssl_port, cherrypy_port
patch_auth()
model = Model(None, "/tmp/obj-store-test")
host = "127.0.0.1"
port = get_free_port("http")
ssl_port = get_free_port("https")
cherrypy_port = get_free_port("cherrypy_port")
test_server = run_server(host, port, ssl_port, test_mode=True, cherrypy_port=cherrypy_port, model=model)
示例11: setUpModule
def setUpModule():
global test_server, model, host, port, ssl_port, cherrypy_port
patch_auth()
model = MockModel('/tmp/obj-store-test')
host = '127.0.0.1'
port = get_free_port('http')
ssl_port = get_free_port('https')
cherrypy_port = get_free_port('cherrypy_port')
test_server = run_server(host, port, ssl_port, test_mode=True,
cherrypy_port=cherrypy_port, model=model)
示例12: setUpModule
def setUpModule():
global test_server, model, host, ssl_port, tmpfile
patch_auth()
tmpfile = tempfile.mktemp()
model = MockModel(tmpfile)
host = '127.0.0.1'
port = get_free_port('http')
ssl_port = get_free_port('https')
cherrypy_port = get_free_port('cherrypy_port')
test_server = run_server(host, port, ssl_port, test_mode=True,
cherrypy_port=cherrypy_port, model=model)
示例13: setUpModule
def setUpModule():
global host, port, ssl_port, model, test_server, fake_iso
cherrypy.request.headers = {'Accept': 'application/json'}
model = mockmodel.MockModel('/tmp/obj-store-test')
patch_auth()
port = get_free_port('http')
ssl_port = get_free_port('https')
host = '127.0.0.1'
test_server = run_server(host, port, ssl_port, test_mode=True,
model=model)
fake_iso = '/tmp/fake.iso'
open(fake_iso, 'w').close()