From 2243ab241a4a3f05160d22dc42f054a824c426dd Mon Sep 17 00:00:00 2001 From: BubaVV Date: Sun, 14 Oct 2018 01:54:51 +0300 Subject: Tests added to pass CI Hope it's enough. Exception raising in wsgi() is covered --- test/test_exc.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 test/test_exc.py diff --git a/test/test_exc.py b/test/test_exc.py new file mode 100644 index 0000000..fca38dc --- /dev/null +++ b/test/test_exc.py @@ -0,0 +1,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') -- cgit v1.2.1