~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http_response.py

  • Committer: Jelmer Vernooij
  • Date: 2012-08-02 10:38:21 UTC
  • mto: This revision was merged to the branch mainline in revision 6555.
  • Revision ID: jelmer@samba.org-20120802103821-pto2dgacjtmpzl1n
Move color feature into bzrlib.tests.features.

Show diffs side-by-side

added added

removed removed

Lines of Context:
75
75
        pass
76
76
 
77
77
 
78
 
class TestResponseFileIter(tests.TestCase):
79
 
 
80
 
    def test_iter_empty(self):
81
 
        f = response.ResponseFile('empty', StringIO())
82
 
        self.assertEqual([], list(f))
83
 
 
84
 
    def test_iter_many(self):
85
 
        f = response.ResponseFile('many', StringIO('0\n1\nboo!\n'))
86
 
        self.assertEqual(['0\n', '1\n', 'boo!\n'], list(f))
87
 
 
88
 
 
89
78
class TestHTTPConnection(tests.TestCase):
90
79
 
91
80
    def test_cleanup_pipe(self):
148
137
 
149
138
    def test_read_zero(self):
150
139
        f = self._file
 
140
        start = self.first_range_start
151
141
        self.assertEquals('', f.read(0))
152
142
        f.seek(10, 1)
153
143
        self.assertEquals('', f.read(0))
381
371
 
382
372
    def test_seek_across_ranges(self):
383
373
        f = self._file
 
374
        start = self.first_range_start
384
375
        f.seek(126) # skip the two first ranges
385
376
        self.assertEquals('AB', f.read(2))
386
377
 
387
378
    def test_checked_read_dont_overflow_buffers(self):
388
379
        f = self._file
 
380
        start = self.first_range_start
389
381
        # We force a very low value to exercise all code paths in _checked_read
390
382
        f._discarded_buf_size = 8
391
383
        f.seek(126) # skip the two first ranges
808
800
    """
809
801
 
810
802
    def setUp(self):
811
 
        super(TestRangeFileSizeReadLimited, self).setUp()
 
803
        tests.TestCase.setUp(self)
812
804
        # create a test datablock larger than _max_read_size.
813
805
        chunk_size = response.RangeFile._max_read_size
814
806
        test_pattern = '0123456789ABCDEF'