X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=tests%2Futils.py;h=545a2ba2881372e2bcd479ecd4e8cd2d7da2ed8c;hb=8c0cbef8f467d125ba7c987b3eb1f5bef7d38120;hp=2a919a31dbb057f4db558861d2fafe8277db5521;hpb=e14580b4ee47363cad317e4ec1de91affe03d53a;p=plomtask diff --git a/tests/utils.py b/tests/utils.py index 2a919a3..545a2ba 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -70,9 +70,17 @@ class TestCaseWithServer(TestCaseWithDB): 'Content-Length': str(len(encoded_form_data))} self.conn.request('POST', target, body=encoded_form_data, headers=headers) - if redirect_location == '': - redirect_location = target if 302 == expected_code: + if redirect_location == '': + redirect_location = target 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)