示例#1
0
文件: test_app.py 项目: jjmurre/otto
 def test_not_found(self):
     from otto import Application
     from otto.tests.utils import get_response
     app = Application()
     response = get_response(app, '/path')
     strings = map(str, response)
     self.assertTrue('404 Not Found' in "".join(strings))
示例#2
0
文件: test_app.py 项目: malthe/otto
 def test_not_found(self):
     from otto import Application
     from otto.tests.utils import get_response
     app = Application()
     response = get_response(app, '/path')
     strings = map(str, response)
     self.assertTrue('404 Not Found' in "".join(strings))
示例#3
0
def assert_response(url, app, value):
    response = get_response(app, url.strip('\n '))
    try:
        result = ''.join(response)
    except TypeError:
        result = ''.join([part.decode('utf-8') for part in response])

    result = strip(result)
    value = strip(value)
    compare(result, value)
示例#4
0
文件: test_app.py 项目: malthe/otto
 def test_forbidden(self):
     from otto import Application
     from otto.tests.utils import get_response
     app = Application()
     import webob.exc
     @app.connect('/')
     def controller(request):
         raise webob.exc.HTTPForbidden("No access.")
     response = get_response(app, '/')
     strings = map(str, response)
     self.assertTrue('403 Forbidden' in "".join(strings))
示例#5
0
文件: test_app.py 项目: jjmurre/otto
    def test_forbidden(self):
        from otto import Application
        from otto.tests.utils import get_response
        app = Application()
        import webob.exc

        @app.connect('/')
        def controller(request):
            raise webob.exc.HTTPForbidden("No access.")

        response = get_response(app, '/')
        strings = map(str, response)
        self.assertTrue('403 Forbidden' in "".join(strings))
示例#6
0
文件: test_app.py 项目: mrtopf/otto
 def test_not_found(self):
     from otto.app import WebObApplication
     from otto.tests.utils import get_response
     app = WebObApplication()
     self.assertEqual(get_response(app, '/path'), ['Page not found'])