本文整理匯總了Python中nuclide_server.NuclideServer.start方法的典型用法代碼示例。如果您正苦於以下問題:Python NuclideServer.start方法的具體用法?Python NuclideServer.start怎麽用?Python NuclideServer.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類nuclide_server.NuclideServer
的用法示例。
在下文中一共展示了NuclideServer.start方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_multiple_servers
# 需要導入模塊: from nuclide_server import NuclideServer [as 別名]
# 或者: from nuclide_server.NuclideServer import start [as 別名]
def test_multiple_servers(self):
server_9090 = NuclideServer(9090)
self.assertEquals(server_9090.start(timeout=TIMEOUT), 0)
self.assertTrue(server_9090.is_healthy())
server_9091 = NuclideServer(9091)
self.assertEquals(server_9091.start(timeout=TIMEOUT), 0)
self.assertTrue(server_9091.is_healthy())
# No server on port 9092
server_9092 = NuclideServer(9092)
self.assertFalse(server_9092.is_healthy())
self.assertEquals(server_9090.stop(), 0)
self.assertFalse(server_9090.is_healthy())
self.assertTrue(server_9091.is_healthy())
# Create new server objects to rebind and check states again.
server_9090 = NuclideServer(9090)
server_9091 = NuclideServer(9091)
self.assertFalse(server_9090.is_healthy())
self.assertTrue(server_9091.is_healthy())
示例2: test_get_certificates
# 需要導入模塊: from nuclide_server import NuclideServer [as 別名]
# 或者: from nuclide_server.NuclideServer import start [as 別名]
def test_get_certificates(self):
gen = NuclideCertificatesGenerator(tempfile.gettempdir(), 'localhost', 'test')
server_9090 = NuclideServer(9090)
ret = server_9090.start(timeout=TIMEOUT, cert=gen.server_cert, key=gen.server_key, ca=gen.ca_cert)
self.assertEquals(ret, 0)
# Verify cert files.
server_cert, server_key, ca = server_9090.get_server_certificate_files()
self.assertEquals(server_cert, gen.server_cert)
self.assertEquals(server_key, gen.server_key)
self.assertEquals(ca, gen.ca_cert)
client_cert, client_key = NuclideServer.get_client_certificate_files(ca)
self.assertEquals(client_cert, gen.client_cert)
self.assertEquals(client_key, gen.client_key)
# Verify same cert files after restart.
server_9090.restart(timeout=TIMEOUT)
server_cert, server_key, ca = server_9090.get_server_certificate_files()
self.assertEquals(server_cert, gen.server_cert)
self.assertEquals(server_key, gen.server_key)
self.assertEquals(ca, gen.ca_cert)