From e4280c730455138952ae14caeb0f5aa3fc7a340a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Nut=CC=A6iu?= Date: Thu, 20 Apr 2017 16:24:59 +0300 Subject: [PATCH] Adding tests for 400 and 405 pages --- test/test_scoreboard.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/test/test_scoreboard.py b/test/test_scoreboard.py index 3b2c559..c0700ee 100644 --- a/test/test_scoreboard.py +++ b/test/test_scoreboard.py @@ -60,7 +60,7 @@ class ScoreboardTestCase(unittest.TestCase): gpu="CpuTesting2", cpu="GPUTesting2", log="This is a logfile", - score=200 + score="200" ) response = self.client.post('/result', data=json.dumps(data), content_type='application/json') @@ -82,6 +82,15 @@ class ScoreboardTestCase(unittest.TestCase): response = self.client.get('/upload') self.assertEqual(response.status_code, 200) + def test_method_not_allowed(self): + response = self.client.post('/upload') + self.assertEqual(response.status_code, 405) + self.assertTrue("405" in response.get_data(as_text=True)) + + def test_bad_request(self): + response = self.client.post('/result', data={'mambo':'jambo'}) + self.assertEqual(response.status_code, 400) + def test_pagination(self): data1 = Result(cpu="TestCPU", gpu="TestGPU", log="TestLOG", score=11) data2 = Result(cpu="TestCPU", gpu="TestGPU", log="TestLOG", score=22)