Debian Codegraph @

pecan/scaffolds/base/+package+/tests/test_functional.py_tmpl

raw
1 from unittest import TestCase
2 from webtest import TestApp
3 from ${package}.tests import FunctionalTest
4
5
6 class TestRootController(FunctionalTest):
7
8 def test_get(self):
9 response = self.app.get('/')
10 assert response.status_int == 200
11
12 def test_search(self):
13 response = self.app.post('/', params={'q': 'RestController'})
14 assert response.status_int == 302
15 assert response.headers['Location'] == (
16 'https://pecan.readthedocs.io/en/latest/search.html'
17 '?q=RestController'
18 )
19
20 def test_get_not_found(self):
21 response = self.app.get('/a/bogus/url', expect_errors=True)
22 assert response.status_int == 404