~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_http_response.py

  • Committer: Kit Randel
  • Date: 2014-12-15 20:24:42 UTC
  • mto: This revision was merged to the branch mainline in revision 6602.
  • Revision ID: kit.randel@canonical.com-20141215202442-usf2ixhypqg8yh6q
added a note for bug-1400567 to the 2.7b release notes

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
 
78
89
class TestHTTPConnection(tests.TestCase):
79
90
 
80
91
    def test_cleanup_pipe(self):
137
148
 
138
149
    def test_read_zero(self):
139
150
        f = self._file
140
 
        start = self.first_range_start
141
151
        self.assertEquals('', f.read(0))
142
152
        f.seek(10, 1)
143
153
        self.assertEquals('', f.read(0))
371
381
 
372
382
    def test_seek_across_ranges(self):
373
383
        f = self._file
374
 
        start = self.first_range_start
375
384
        f.seek(126) # skip the two first ranges
376
385
        self.assertEquals('AB', f.read(2))
377
386
 
378
387
    def test_checked_read_dont_overflow_buffers(self):
379
388
        f = self._file
380
 
        start = self.first_range_start
381
389
        # We force a very low value to exercise all code paths in _checked_read
382
390
        f._discarded_buf_size = 8
383
391
        f.seek(126) # skip the two first ranges
800
808
    """
801
809
 
802
810
    def setUp(self):
803
 
        tests.TestCase.setUp(self)
 
811
        super(TestRangeFileSizeReadLimited, self).setUp()
804
812
        # create a test datablock larger than _max_read_size.
805
813
        chunk_size = response.RangeFile._max_read_size
806
814
        test_pattern = '0123456789ABCDEF'