def test_do_GET(self) -> None:
"""Test /condition and /conditions response codes."""
- self.check_get('/condition', 200)
- self.check_get('/condition?id=', 200)
- self.check_get('/condition?id=0', 500)
- self.check_get('/condition?id=FOO', 400)
+ form_data = {'title': 'foo', 'description': 'foo'}
+ self.check_post(form_data, '/condition', 302, '/condition?id=1')
+ self.check_get_defaults('/condition')
self.check_get('/conditions', 200)
def test_do_GET(self) -> None:
"""Test /process and /processes response codes."""
- self.check_get('/process', 200)
- self.check_get('/process?id=', 200)
- self.check_get('/process?id=0', 500)
- self.check_get('/process?id=FOO', 400)
+ form_data = {'title': 'foo', 'description': 'foo', 'effort': 1.1}
+ self.check_post(form_data, '/process?id=', 302, '/process?id=1')
+ self.check_get_defaults('/process')
self.check_get('/processes', 200)
self.check_redirect(redirect_location)
else:
self.assertEqual(self.conn.getresponse().status, expected_code)
+
+ def check_get_defaults(self, path: str) -> None:
+ """Some standard model paths to test."""
+ self.check_get(path, 200)
+ self.check_get(f'{path}?id=', 200)
+ self.check_get(f'{path}?id=foo', 400)
+ self.check_get(f'/{path}?id=0', 500)
+ self.check_get(f'{path}?id=1', 200)