Esempio n. 1
0
 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))
Esempio n. 2
0
 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))
Esempio n. 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)
Esempio n. 4
0
 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))
Esempio n. 5
0
    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))
Esempio n. 6
0
 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'])