~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: John Arbash Meinel
  • Date: 2009-07-29 21:35:05 UTC
  • mfrom: (4576 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4577.
  • Revision ID: john@arbash-meinel.com-20090729213505-tkqsvy1zfpocu75w
Merge bzr.dev 4576 in prep for NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
1507
1507
        ex = self.assertRaises(errors.ConnectionReset,
1508
1508
            response_handler.read_response_tuple)
1509
1509
        self.assertEqual("Connection closed: "
1510
 
            "please check connectivity and permissions ",
 
1510
            "Unexpected end of message. Please check connectivity "
 
1511
            "and permissions, and report a bug if problems persist. ",
1511
1512
            str(ex))
1512
1513
 
1513
1514
    def test_server_offset_serialisation(self):
2296
2297
        self.assertEqual(0, smart_protocol.next_read_size())
2297
2298
        self.assertEqual('', smart_protocol.unused_data)
2298
2299
 
 
2300
    def test_repeated_excess(self):
 
2301
        """Repeated calls to accept_bytes after the message end has been parsed
 
2302
        accumlates the bytes in the unused_data attribute.
 
2303
        """
 
2304
        output = StringIO()
 
2305
        headers = '\0\0\0\x02de'  # length-prefixed, bencoded empty dict
 
2306
        end = 'e'
 
2307
        request_bytes = headers + end
 
2308
        smart_protocol = self.server_protocol_class(LoggingMessageHandler())
 
2309
        smart_protocol.accept_bytes(request_bytes)
 
2310
        self.assertEqual('', smart_protocol.unused_data)
 
2311
        smart_protocol.accept_bytes('aaa')
 
2312
        self.assertEqual('aaa', smart_protocol.unused_data)
 
2313
        smart_protocol.accept_bytes('bbb')
 
2314
        self.assertEqual('aaabbb', smart_protocol.unused_data)
 
2315
        self.assertEqual(0, smart_protocol.next_read_size())
 
2316
 
2299
2317
    def make_protocol_expecting_message_part(self):
2300
2318
        headers = '\0\0\0\x02de'  # length-prefixed, bencoded empty dict
2301
2319
        message_handler = LoggingMessageHandler()
3526
3544
        # still work correctly.
3527
3545
        base_transport = remote.RemoteHTTPTransport('bzr+http://host/%7Ea/b')
3528
3546
        new_transport = base_transport.clone('c')
3529
 
        self.assertEqual('bzr+http://host/%7Ea/b/c/', new_transport.base)
 
3547
        self.assertEqual('bzr+http://host/~a/b/c/', new_transport.base)
3530
3548
        self.assertEqual(
3531
3549
            'c/',
3532
3550
            new_transport._client.remote_path_from_transport(new_transport))