本文整理汇总了Python中mocket.mocket.Mocket.reset方法的典型用法代码示例。如果您正苦于以下问题:Python Mocket.reset方法的具体用法?Python Mocket.reset怎么用?Python Mocket.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mocket.mocket.Mocket
的用法示例。
在下文中一共展示了Mocket.reset方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_client_throws_error_when_connection_lost
# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
def test_client_throws_error_when_connection_lost(self):
"""
Scenario: The client loses its connection to the server
When the connection to the server is lost
Given two seconds later
Then the client throws a "connectionError" error with message "Can't connect! Deepstream server unreachable"
And the clients connection state is "RECONNECTING"
"""
ack = C.ACTIONS_ACK + C.MESSAGE_PART_SEPARATOR + C.ACTIONS_ACK + C.MESSAGE_SEPARATOR
Mocket.register(MocketEntry(('localhost', 8989), [str.encode(ack)]))
ds = DeepStreamClient('localhost', 8989)
ds.login({"username": "XXX", "password": "YYY"}, None)
time.sleep(1)
Mocket.reset()
time.sleep(1)
with self.assertRaises(Exception) as c:
ds.event.subscribe('event1', None)
time.sleep(2)
self.assertTrue("Can't connect! Deepstream server unreachable" in c.exception.args[0])
示例2: setUp
# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
def setUp(self):
Mocket.reset()
示例3: test_reset
# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
def test_reset(self):
Mocket._requests.extend([1, 2, 3])
self.assertEqual(Mocket._requests, [1, 2, 3])
Mocket.reset()
self.assertEqual(Mocket._requests, [])
示例4: mocketize_setup
# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
def mocketize_setup(self):
Entry.register_response('FLUSHDB', OK)
self.rclient.flushdb()
self.assertEqual(len(Mocket._requests), 1)
Mocket.reset()
示例5: teardown_method
# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
def teardown_method(self, test_method):
Mocket.reset()