~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

Rename 'setProtoAndMedium' to more accurate 'setProtoAndMediumRequest', add ABCs for Requesters and ResponseHandlers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1394
1394
    client_protocol_class = None
1395
1395
 
1396
1396
    def make_client_protocol_and_output(self, input_bytes=None):
 
1397
        """
 
1398
        :returns: a Request
 
1399
        """
1397
1400
        # This is very similar to
1398
1401
        # bzrlib.smart.client._SmartClient._build_client_protocol
1399
1402
        if input_bytes is None:
1412
1415
            requester = self.request_encoder(request)
1413
1416
            response_handler = message.ConventionalResponseHandler()
1414
1417
            response_protocol = self.response_decoder(response_handler)
1415
 
            response_handler.setProtoAndMedium(response_protocol, request)
 
1418
            response_handler.setProtoAndMediumRequest(
 
1419
                response_protocol, request)
1416
1420
            return requester, response_handler, output
1417
1421
 
1418
1422
    def make_client_protocol(self, input_bytes=None):
2387
2391
            StringIO(interrupted_body_stream), output)
2388
2392
        medium_request = client_medium.get_request()
2389
2393
        medium_request.finished_writing()
2390
 
        response_handler.setProtoAndMedium(protocol_decoder, medium_request)
 
2394
        response_handler.setProtoAndMediumRequest(
 
2395
            protocol_decoder, medium_request)
2391
2396
        stream = response_handler.read_streamed_body()
2392
2397
        self.assertEqual('chunk one', stream.next())
2393
2398
        self.assertEqual('chunk two', stream.next())
2433
2438
        """Make v3 response decoder using a conventional response handler."""
2434
2439
        response_handler = message.ConventionalResponseHandler()
2435
2440
        decoder = protocol.ProtocolThreeDecoder(response_handler)
2436
 
        response_handler.setProtoAndMedium(decoder, StubRequest())
 
2441
        response_handler.setProtoAndMediumRequest(decoder, StubRequest())
2437
2442
        return decoder, response_handler
2438
2443
 
2439
2444
    def test_trivial_response_decoding(self):