~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: 2009-01-09 06:11:34 UTC
  • mto: (3842.3.16 RemoteVersionedFile)
  • mto: This revision was merged to the branch mainline in revision 3981.
  • Revision ID: andrew.bennetts@canonical.com-20090109061134-ulc6y3mpz1djqigh
Completely delegate handling of request body chunks to the command object.  The default implementation accumulates, like the existing behaviour.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1489
1489
        smart_protocol._has_dispatched = True
1490
1490
        smart_protocol.request = _mod_request.SmartServerRequestHandler(
1491
1491
            None, _mod_request.request_handlers, '/')
1492
 
        class FakeCommand(object):
1493
 
            def do_body(cmd, body_bytes):
 
1492
        class FakeCommand(_mod_request.SmartServerRequest):
 
1493
            def do_body(self_cmd, body_bytes):
1494
1494
                self.end_received = True
1495
1495
                self.assertEqual('abcdefg', body_bytes)
1496
1496
                return _mod_request.SuccessfulSmartServerResponse(('ok', ))
1497
 
        smart_protocol.request._command = FakeCommand()
 
1497
        smart_protocol.request._command = FakeCommand(None)
1498
1498
        # Call accept_bytes to make sure that internal state like _body_decoder
1499
1499
        # is initialised.  This test should probably be given a clearer
1500
1500
        # interface to work with that will not cause this inconsistency.
2538
2538
        self.calls = []
2539
2539
        self.finished_reading = False
2540
2540
 
2541
 
    def body_chunk_received(self, chunk_bytes):
2542
 
        self.calls.append(('body_chunk_received', chunk_bytes))
2543
 
 
2544
2541
    def no_body_received(self):
2545
2542
        self.calls.append(('no_body_received',))
2546
2543
 
2547
 
    def prefixed_body_received(self, body_bytes):
2548
 
        self.calls.append(('prefixed_body_received', body_bytes))
2549
 
 
2550
2544
    def end_received(self):
2551
2545
        self.calls.append(('end_received',))
2552
2546
        self.finished_reading = True