Merge pull request #312 from felixpalta/Runscope-GH-296-fix-drip-with-zero-numbytes

Fix error 500 on drip due to division by zero (issue #296)
This commit is contained in:
2017-03-16 20:21:09 -04:00
committed by GitHub
2 changed files with 11 additions and 1 deletions
+6
View File
@@ -312,6 +312,12 @@ class HttpbinTestCase(unittest.TestCase):
self.assertEqual(len(self.get_data(response)), 400)
self.assertEqual(response.status_code, 200)
def test_drip_with_invalid_numbytes(self):
for bad_num in -1, 0:
uri = '/drip?numbytes={0}&duration=2&delay=1'.format(bad_num)
response = self.app.get(uri)
self.assertEqual(response.status_code, 400)
def test_drip_with_custom_code(self):
response = self.app.get('/drip?numbytes=400&duration=2&code=500')
self.assertEqual(response.content_length, 400)