~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_transport.py

  • Committer: Andrew Bennetts
  • Date: 2008-02-22 07:32:38 UTC
  • mto: (3245.4.1 Version 3 implementation.)
  • mto: This revision was merged to the branch mainline in revision 3428.
  • Revision ID: andrew.bennetts@canonical.com-20080222073238-jozps1rp097z0en5
Some tests now passing using protocol 3.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2059
2059
    def __init__(self):
2060
2060
        self.event_log = []
2061
2061
 
 
2062
    def _log(self, *args):
 
2063
        self.event_log.append(args)
 
2064
 
2062
2065
    def headers_received(self, headers):
2063
 
        self.event_log.append(('headers', headers))
2064
 
 
2065
 
    def byte_received(self, byte):
2066
 
        self.event_log.append(('byte', byte))
2067
 
 
2068
 
    def bytes_received(self, bytes):
2069
 
        self.event_log.append(('bytes', bytes))
2070
 
 
2071
 
    def structure_received(self, structure):
2072
 
        self.event_log.append(('structure', structure))
 
2066
        self._log('headers', headers)
 
2067
 
 
2068
    def protocol_error(self, exception):
 
2069
        self._log('protocol_error', exception)
 
2070
 
 
2071
    def byte_part_received(self, byte):
 
2072
        self._log('byte', byte)
 
2073
 
 
2074
    def bytes_part_received(self, bytes):
 
2075
        self._log('bytes', bytes)
 
2076
 
 
2077
    def structure_part_received(self, structure):
 
2078
        self._log('structure', structure)
 
2079
 
 
2080
    def end_received(self):
 
2081
        self._log('end')
2073
2082
 
2074
2083
 
2075
2084
class TestProtocolThree(TestSmartProtocol):
2300
2309
        smart_protocol, output = self.make_client_encoder_and_output()
2301
2310
        smart_protocol.call('one arg', headers={'header name': 'header value'})
2302
2311
        self.assertEquals(
2303
 
            'bzr request 3 (bzr 1.3)\n' # protocol version
 
2312
            'bzr message 3 (bzr 1.3)\n' # protocol version
2304
2313
            '\x00\x00\x00\x1fd11:header name12:header valuee' # headers
2305
2314
            's\x00\x00\x00\x0bl7:one arge' # args
2306
2315
            'e', # end
2326
2335
            ('one arg',), 'body bytes',
2327
2336
            headers={'header name': 'header value'})
2328
2337
        self.assertEquals(
2329
 
            'bzr request 3 (bzr 1.3)\n' # protocol version
 
2338
            'bzr message 3 (bzr 1.3)\n' # protocol version
2330
2339
            '\x00\x00\x00\x1fd11:header name12:header valuee' # headers
2331
2340
            's\x00\x00\x00\x0bl7:one arge' # args
2332
2341
            'b' # there is a prefixed body