/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-01-18 01:16:25 UTC
  • mfrom: (3184.1.13 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080118011625-465mgy0mhdz1jiky
(robertc) Reduce traffic when requesting revision streams from a
        smart server (3 MB to 172 bytes for a full bzr.dev pull)
        (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
829
829
        tree.add('')
830
830
        rev_id1_utf8 = u'\xc8'.encode('utf-8')
831
831
        rev_id2_utf8 = u'\xc9'.encode('utf-8')
832
 
        r1 = tree.commit('1st commit', rev_id=rev_id1_utf8)
833
 
        r1 = tree.commit('2nd commit', rev_id=rev_id2_utf8)
 
832
        tree.commit('1st commit', rev_id=rev_id1_utf8)
 
833
        tree.commit('2nd commit', rev_id=rev_id2_utf8)
834
834
        tree.unlock()
835
835
 
836
 
        response = request.execute(backing.local_abspath(''), rev_id2_utf8)
 
836
        response = request.execute(backing.local_abspath(''))
 
837
        self.assertEqual(None, response)
 
838
        response = request.do_body("%s\n%s\n1" % (rev_id2_utf8, rev_id1_utf8))
837
839
        self.assertEqual(('ok',), response.args)
838
840
        from cStringIO import StringIO
839
841
        parser = pack.ContainerPushParser()
853
855
            backing)
854
856
        repo = self.make_repository('.')
855
857
        rev_id1_utf8 = u'\xc8'.encode('utf-8')
856
 
        response = request.execute(backing.local_abspath(''), rev_id1_utf8)
857
 
        # There's no error initially.
858
 
        self.assertTrue(response.is_successful())
859
 
        self.assertEqual(('ok',), response.args)
860
 
        # We only get an error while streaming the body.
861
 
        body = list(response.body_stream)
862
 
        last_chunk = body[-1]
863
 
        self.assertIsInstance(last_chunk, FailedSmartServerResponse)
 
858
        response = request.execute(backing.local_abspath(''))
 
859
        self.assertEqual(None, response)
 
860
        response = request.do_body("%s\n\n1" % (rev_id1_utf8,))
864
861
        self.assertEqual(
865
 
            last_chunk,
866
 
            FailedSmartServerResponse(('NoSuchRevision', rev_id1_utf8)))
 
862
            FailedSmartServerResponse(('NoSuchRevision', )),
 
863
            response)
867
864
 
868
865
 
869
866
class TestSmartServerIsReadonly(tests.TestCaseWithTransport):
935
932
            smart.request.request_handlers.get('Repository.lock_write'),
936
933
            smart.repository.SmartServerRepositoryLockWrite)
937
934
        self.assertEqual(
938
 
            smart.request.request_handlers.get(
939
 
                'Repository.chunked_stream_knit_data_for_revisions'),
940
 
            smart.repository.SmartServerRepositoryStreamKnitDataForRevisions)
941
 
        self.assertEqual(
942
935
            smart.request.request_handlers.get('Repository.tarball'),
943
936
            smart.repository.SmartServerRepositoryTarball)
944
937
        self.assertEqual(