Ticket #15018: test_for_ticket_15018.diff

File test_for_ticket_15018.diff, 862 bytes (added by aaugustin, 5 years ago)
  • tests/regressiontests/requests/tests.py

     
    129129        # Read everything else.
    130130        self.assertEqual(stream.readline(), 'ijkl')
    131131
     132    def test_limited_stream_ticket_15018(self):
     133        stream = LimitedStream(StringIO('\nabc'), 3)
     134        self.assertEqual(stream.readline(3), '\n')
     135        self.assertEqual(stream.readline(1), 'a')
     136        self.assertEqual(stream.readline(1), 'b')
     137        # Hit stream limit
     138        self.assertEqual(stream.readline(1), '')
     139
    132140    def test_stream(self):
    133141        request = WSGIRequest({'REQUEST_METHOD': 'POST', 'wsgi.input': StringIO('name=value')})
    134142        self.assertEqual(request.read(), 'name=value')
Back to Top