当前位置: 首页>>代码示例>>Python>>正文


Python Mocket.reset方法代码示例

本文整理汇总了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])
开发者ID:AlexBHarley,项目名称:deepstream.py,代码行数:22,代码来源:connectivity_test.py

示例2: setUp

# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
 def setUp(self):
     Mocket.reset()
开发者ID:xcash,项目名称:python-mocket,代码行数:4,代码来源:test_mocket.py

示例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, [])
开发者ID:xcash,项目名称:python-mocket,代码行数:7,代码来源:test_mocket.py

示例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()
开发者ID:MPOWER4RU,项目名称:python-mocket,代码行数:7,代码来源:test_redis.py

示例5: teardown_method

# 需要导入模块: from mocket.mocket import Mocket [as 别名]
# 或者: from mocket.mocket.Mocket import reset [as 别名]
 def teardown_method(self, test_method):
     Mocket.reset()
开发者ID:AlexBHarley,项目名称:deepstream.py,代码行数:4,代码来源:connectivity_test.py


注:本文中的mocket.mocket.Mocket.reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。