Skip to content

Commit b8a5e17

Browse files
Fix /makeimage/ returning None after the merge
1 parent 80367db commit b8a5e17

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎codespeed/tests/test_views.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,18 @@ def test_timeline(self):
420420
responsedata = response.content.decode()
421421
self.assertIn('My Own Title\n: Timeline', responsedata)
422422

423+
def test_makeimage(self):
424+
response = self.client.get(reverse('makeimage'), {
425+
'env': 'Dual Core', 'proj': 'MyProject', 'branch': 'master',
426+
'exe': 'myexe O3 64bits', 'ben': 'float'})
427+
self.assertEqual(response.status_code, 200)
428+
self.assertEqual(response['Content-Type'], 'image/png')
429+
self.assertTrue(response.content.startswith(b'\x89PNG'))
430+
431+
def test_makeimage_bad_request(self):
432+
response = self.client.get(reverse('makeimage'), {'env': 'Dual Core'})
433+
self.assertEqual(response.status_code, 400)
434+
423435
def test_gettimelinedata(self):
424436
"""Test that gettimelinedata returns correct timeline data
425437
"""

‎codespeed/views.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,6 +1178,8 @@ def makeimage(request):
11781178
response['Content-Length'] = len(image_data)
11791179
response['Content-Disposition'] = 'attachment; filename=image.png'
11801180

1181+
return response
1182+
11811183

11821184
def _get_current_commit():
11831185
try:
@@ -1195,5 +1197,3 @@ def _get_current_commit():
11951197

11961198
def about(request):
11971199
return render(request, 'about.html', {'commit': _CURRENT_COMMIT})
1198-
1199-
return response

0 commit comments

Comments
 (0)