~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_wsgi.py

Merge hpss-protocol2.

Show diffs side-by-side

added added

removed removed

Lines of Context:
204
204
        self.assertEqual('error\x01incomplete request\n', response)
205
205
 
206
206
    def test_protocol_version_detection_one(self):
207
 
        # SmartWSGIApp detects requests that don't start with '2\x01' as version
 
207
        # SmartWSGIApp detects requests that don't start with '2\n' as version
208
208
        # one.
209
209
        transport = memory.MemoryTransport()
210
210
        wsgi_app = wsgi.SmartWSGIApp(transport)
222
222
        self.assertEqual('ok\x012\n', response)
223
223
 
224
224
    def test_protocol_version_detection_two(self):
225
 
        # SmartWSGIApp detects requests that start with '2\x01' as version two.
 
225
        # SmartWSGIApp detects requests that start with '2\n' as version two.
226
226
        transport = memory.MemoryTransport()
227
227
        wsgi_app = wsgi.SmartWSGIApp(transport)
228
 
        fake_input = StringIO('2\x01hello\n')
 
228
        fake_input = StringIO('2\nhello\n')
229
229
        environ = self.build_environ({
230
230
            'REQUEST_METHOD': 'POST',
231
231
            'CONTENT_LENGTH': len(fake_input.getvalue()),
236
236
        response = self.read_response(iterable)
237
237
        self.assertEqual('200 OK', self.status)
238
238
        # Expect a version 2-encoded response.
239
 
        self.assertEqual('2\x01ok\x012\n', response)
 
239
        self.assertEqual('2\nok\x012\n', response)
240
240
 
241
241
 
242
242
class FakeRequest(object):