blob: fca38dc67633560ca460d97c5a23378a9e04e590 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
import bottle
from .tools import ServerTestBase
class TestError(Exception):
pass
class TestAppException(ServerTestBase):
def test_no_exc(self):
@bottle.route('/')
def test(): return 'test'
self.assertBody('test', '/')
def test_memory_error(self):
@bottle.route('/')
def test(): raise MemoryError
self.assertRaises(MemoryError)
def test_other_error(self):
@bottle.route('/')
def test(): raise TestError
self.assertRaises(TestError)
def test_noncatched_error(self):
@bottle.route('/')
def test(): raise TestError
bottle.request.environ['exc_info'] = None
bottle.catchall = False
self.assertStatus(500, '/')
self.assertInBody('TestError')
|