コード例 #1
0
 def test_transport_exposed(self):
     """
     The transport exposed is the underlying twisted transport, if it exists
     """
     client = TestingCQLClient(self.endpoint, 'meh')
     self.assertEqual(client.transport, None)  # has not connected yet
     self.assertFired(client.describe_version())
     self.assertIs(client.transport, self.twisted_transport)
コード例 #2
0
    def test_pause(self):
        """
        When pausing, stop reading and stop writing on the transport are called
        if the transport exists.
        """
        client = TestingCQLClient(self.endpoint, 'meh')
        client.pause()
        self.assertEqual(len(self.twisted_transport.stopReading.mock_calls), 0)
        self.assertEqual(len(self.twisted_transport.stopWriting.mock_calls), 0)

        self.assertFired(client.describe_version())
        client.pause()
        self.twisted_transport.stopReading.assert_called_one_with()
        self.twisted_transport.stopWriting.assert_called_one_with()