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


Python CQLClient.disconnect方法代码示例

本文整理汇总了Python中silverberg.client.CQLClient.disconnect方法的典型用法代码示例。如果您正苦于以下问题:Python CQLClient.disconnect方法的具体用法?Python CQLClient.disconnect怎么用?Python CQLClient.disconnect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在silverberg.client.CQLClient的用法示例。


在下文中一共展示了CQLClient.disconnect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_disconnect

# 需要导入模块: from silverberg.client import CQLClient [as 别名]
# 或者: from silverberg.client.CQLClient import disconnect [as 别名]
 def test_disconnect(self):
     """
     When disconnect is called, the on demand thrift client is disconnected
     """
     client = CQLClient(self.endpoint, 'blah')
     self.assertFired(client.describe_version())
     client.disconnect()
     self.twisted_transport.loseConnection.assert_called_once_with()
开发者ID:riltsken,项目名称:silverberg,代码行数:10,代码来源:test_client.py

示例2: test_disconnect_on_cancel_returns_correct_value

# 需要导入模块: from silverberg.client import CQLClient [as 别名]
# 或者: from silverberg.client.CQLClient import disconnect [as 别名]
    def test_disconnect_on_cancel_returns_correct_value(self):
        """
        with disconnect_on_cancel=True, the value from execute_cql3_query is
        returned before cancellation
        """
        exec_d = defer.Deferred()
        self.client_proto.execute_cql3_query.side_effect = lambda *_: exec_d
        client = CQLClient(self.endpoint, "abc", disconnect_on_cancel=True)
        client.disconnect = mock.Mock()

        d = client.execute("query", {}, ConsistencyLevel.ONE)

        self.assertNoResult(d)
        self.assertFalse(client.disconnect.called)
        exec_d.callback(self.mock_results)
        self.assertEqual(self.successResultOf(d), 1)
        self.assertFalse(client.disconnect.called)
开发者ID:harii,项目名称:silverberg,代码行数:19,代码来源:test_client.py

示例3: test_no_disconnect_on_cancel

# 需要导入模块: from silverberg.client import CQLClient [as 别名]
# 或者: from silverberg.client.CQLClient import disconnect [as 别名]
    def test_no_disconnect_on_cancel(self):
        """
        If not given, cancellation of running query should not try to disconnect
        the TCP connection
        """
        self.client_proto.execute_cql3_query.side_effect = lambda *_: defer.Deferred()
        client = CQLClient(self.endpoint, "abc", disconnect_on_cancel=False)
        client.disconnect = mock.Mock()

        d = client.execute("query", {}, ConsistencyLevel.ONE)

        self.assertNoResult(d)
        self.assertFalse(client.disconnect.called)

        d.cancel()
        self.failureResultOf(d, defer.CancelledError)
        self.assertFalse(client.disconnect.called)
开发者ID:harii,项目名称:silverberg,代码行数:19,代码来源:test_client.py

示例4: test_disconnect_on_cancel

# 需要导入模块: from silverberg.client import CQLClient [as 别名]
# 或者: from silverberg.client.CQLClient import disconnect [as 别名]
    def test_disconnect_on_cancel(self):
        """
        If allowed, cancellation of running query will also try to disconnect
        the TCP connection
        """
        self.client_proto.execute_cql3_query.side_effect = lambda *_: defer.Deferred()
        client = CQLClient(self.endpoint, 'abc', disconnect_on_cancel=True)
        client.disconnect = mock.Mock()

        d = client.execute('query', {}, ConsistencyLevel.ONE)

        self.assertNoResult(d)
        self.assertFalse(client.disconnect.called)

        d.cancel()
        self.failureResultOf(d, defer.CancelledError)
        client.disconnect.assert_called_one_with()
开发者ID:TimothyZhang,项目名称:silverberg,代码行数:19,代码来源:test_client.py


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