Beispiel #1
0
 def test_disconnect(self):
     """
     When disconnect is called, the on demand thrift client is disconnected
     """
     client = TestingCQLClient(self.endpoint, 'blah')
     self.assertFired(client.describe_version())
     client.disconnect()
     self.twisted_transport.loseConnection.assert_called_once_with()
Beispiel #2
0
 def test_transport_exposed(self):
     """
     The transport exposed is the underlying twisted transport, if it exists
     """
     client = TestingCQLClient(self.endpoint, 'meh')
     self.assertIsNone(client.transport)  # has not connected yet
     self.assertFired(client.describe_version())
     self.assertIs(client.transport, self.twisted_transport)
Beispiel #3
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)
Beispiel #4
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()
Beispiel #5
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()