/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 breezy/tests/test_wsgi.py

  • Committer: Jelmer Vernooij
  • Date: 2018-07-17 21:20:55 UTC
  • mto: (7045.3.3 python3-r)
  • mto: This revision was merged to the branch mainline in revision 7050.
  • Revision ID: jelmer@jelmer.uk-20180717212055-apkv1s70oo6wpi6o
Fix a few more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
130
130
        iterable = wsgi_app(environ, self.start_response)
131
131
        response = self.read_response(iterable)
132
132
        self.assertEqual('200 OK', self.status)
133
 
        self.assertEqual('got bytes: fake request', response)
 
133
        self.assertEqual(b'got bytes: fake request', response)
134
134
 
135
135
    def test_relpath_setter(self):
136
136
        # wsgi.RelpathSetter is WSGI "middleware" to set the 'breezy.relpath'
206
206
        iterable = wsgi_app(environ, self.start_response)
207
207
        response = self.read_response(iterable)
208
208
        self.assertEqual('200 OK', self.status)
209
 
        self.assertEqual('error\x01incomplete request\n', response)
 
209
        self.assertEqual(b'error\x01incomplete request\n', response)
210
210
 
211
211
    def test_protocol_version_detection_one(self):
212
212
        # SmartWSGIApp detects requests that don't start with
231
231
        # as version two.
232
232
        transport = memory.MemoryTransport()
233
233
        wsgi_app = wsgi.SmartWSGIApp(transport)
234
 
        fake_input = BytesIO(protocol.REQUEST_VERSION_TWO + 'hello\n')
 
234
        fake_input = BytesIO(protocol.REQUEST_VERSION_TWO + b'hello\n')
235
235
        environ = self.build_environ({
236
236
            'REQUEST_METHOD': 'POST',
237
237
            'CONTENT_LENGTH': len(fake_input.getvalue()),
243
243
        self.assertEqual('200 OK', self.status)
244
244
        # Expect a version 2-encoded response.
245
245
        self.assertEqual(
246
 
            protocol.RESPONSE_VERSION_TWO + 'success\nok\x012\n', response)
 
246
            protocol.RESPONSE_VERSION_TWO + b'success\nok\x012\n', response)
247
247
 
248
248
 
249
249
class TestWSGIJail(tests.TestCaseWithMemoryTransport, WSGITestMixin):
300
300
 
301
301
    def accept_bytes(self, bytes):
302
302
        self.accepted_bytes = bytes
303
 
        self.write_func('got bytes: ' + bytes)
 
303
        self.write_func(b'got bytes: ' + bytes)
304
304
 
305
305
    def next_read_size(self):
306
306
        return 0