Fix bytes endpoint in python3

This commit is contained in:
Kevin McCarthy
2014-06-08 17:42:24 -10:00
parent 32c842f06f
commit 16d6fea9b8
2 changed files with 5 additions and 1 deletions
+1 -1
View File
@@ -458,7 +458,7 @@ def random_bytes(n):
random.seed(int(params['seed']))
response = make_response()
response.data = bytes().join(chr(random.randint(0, 255)) for i in xrange(n))
response.data = os.urandom(n)
response.content_type = 'application/octet-stream'
return response
+4
View File
@@ -129,6 +129,10 @@ class HttpbinTestCase(unittest.TestCase):
self.assertEqual(len(response.get_data()), 400)
self.assertEqual(response.status_code, 200)
def test_get_bytes(self):
response = self.app.get('/bytes/1024')
self.assertEqual(len(response.get_data()), 1024)
self.assertEqual(response.status_code, 200)
if __name__ == '__main__':