~ubuntu-branches/ubuntu/trusty/swift/trusty-updates

« back to all changes in this revision

Viewing changes to test/unit/common/test_wsgi.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2013-01-28 09:40:30 UTC
  • mfrom: (1.2.16)
  • Revision ID: package-import@ubuntu.com-20130128094030-aetz57x2qz9ye2d4
Tags: 1.7.6-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
238
238
        self.assertEquals(e['PATH_INFO'], '/override')
239
239
 
240
240
 
 
241
class TestWSGIContext(unittest.TestCase):
 
242
 
 
243
    def test_app_call(self):
 
244
        statuses = ['200 Ok', '404 Not Found']
 
245
 
 
246
        def app(env, start_response):
 
247
            start_response(statuses.pop(0), [('Content-Length', '3')])
 
248
            yield 'Ok\n'
 
249
 
 
250
        wc = wsgi.WSGIContext(app)
 
251
        r = Request.blank('/')
 
252
        it = wc._app_call(r.environ)
 
253
        self.assertEquals(wc._response_status, '200 Ok')
 
254
        self.assertEquals(''.join(it), 'Ok\n')
 
255
        r = Request.blank('/')
 
256
        it = wc._app_call(r.environ)
 
257
        self.assertEquals(wc._response_status, '404 Not Found')
 
258
        self.assertEquals(''.join(it), 'Ok\n')
 
259
 
 
260
 
241
261
if __name__ == '__main__':
242
262
    unittest.main()