本文整理汇总了Python中Client.Client.ping_server方法的典型用法代码示例。如果您正苦于以下问题:Python Client.ping_server方法的具体用法?Python Client.ping_server怎么用?Python Client.ping_server使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client.Client
的用法示例。
在下文中一共展示了Client.ping_server方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestClient
# 需要导入模块: from Client import Client [as 别名]
# 或者: from Client.Client import ping_server [as 别名]
class TestClient(unittest.TestCase):
def setUp(self):
self.c = Client()
def validate_results(self):
"""Validates that the results file given is a valid set of results"""
# TODO: Make this a lot more more comprehensive than just checking if a
# file exists
self.assertTrue(os.path.isfile("results.html"))
def test_results_output(self):
"""Test if client renders a graph"""
self.c.generate_graphs(data=[graph_data],feedback=False)
self.validate_results()
def test_results_multiple_output(self):
"""Test if client renders a graph more than one graph on a page"""
self.c.generate_graphs(data=[graph_data,graph_data],feedback=False)
self.validate_results()
def test_generate_graphs_from_results(self):
"""Test if client can render graph from server results"""
self.c.generate_graph_from_results(results_data)
self.validate_results()
def test_generating_graph_from_local(self):
"""Tests if client can rendering graphs from a local file"""
# Test if render works for sensor data capture
self.c.generate_graph_from_data_file("data/test_data.csv",feedback=False);
self.validate_results()
# Test if render works for server download
self.c.generate_graph_from_data_file("data/test_data_server.csv",feedback=False);
self.validate_results()
def test_ping(self):
"""Tests if client can reach server"""
self.assertTrue(self.c.ping_server()["result"]=="pong")
def test_download(self):
"""Tests if client can download data from server"""
self.assertTrue(self.c.download(group_ids=[3])["result"])
def test_multiple_group_downloads(self):
"""Tests if client can download data with multiple group ids from
server"""
self.assertTrue(self.c.download(group_ids=[1,3])["result"])
def test_download_logs(self):
"""Tests if client can download logs from the server"""
self.assertTrue(self.c.get_logs()["result"]["lines"])
# Don't want to fill the server with repeated data
"""
def test_upload(self):
with open("data/test_data.csv") as f:
self.c.upload("".join(f.readlines()))
"""
# These require a sensor connected to run
"""