PageRenderTime 33ms CodeModel.GetById 23ms app.highlight 5ms RepoModel.GetById 2ms app.codeStats 0ms

/tests/web/test_request_failure.py

https://bitbucket.org/prologic/circuits/
Python | 24 lines | 16 code | 7 blank | 1 comment | 0 complexity | bd2c496904a644e6d3fd94c3584b6019 MD5 | raw file
 1#!/usr/bin/env python
 2
 3from .helpers import urlopen, HTTPError
 4from circuits.core.handlers import handler
 5from circuits.core.components import BaseComponent
 6
 7
 8class Root(BaseComponent):
 9
10    channel = "web"
11
12    @handler("request", priority=0.2)
13    def request(self, request, response):
14        raise Exception()
15
16
17def test(webapp):
18    try:
19        Root().register(webapp)
20        urlopen(webapp.server.http.base)
21    except HTTPError as e:
22        assert e.code == 500
23    else:
24        assert False