Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bug 994419: Requesting data of non-existent release yields a 500 erro…
…r. r=rail
  • Loading branch information
bhearsum committed Apr 21, 2014
1 parent 7934168 commit 1befbec
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 5 additions & 2 deletions auslib/admin/views/releases.py
Expand Up @@ -196,8 +196,11 @@ def get(self):
class SingleBlobView(AdminView):
""" /releases/[release]/data"""
def get(self, release):
release_blob = db.releases.getReleaseBlob(name=release)
return jsonify(release_blob)
try:
release_blob = db.releases.getReleaseBlob(name=release)
return jsonify(release_blob)
except KeyError:
return Response(status=404)

class SingleReleaseView(AdminView):
""" /releases/[release]"""
Expand Down
3 changes: 3 additions & 0 deletions auslib/test/admin/views/test_releases.py
Expand Up @@ -321,6 +321,9 @@ def testGetSingleReleaseBlob(self):
}
"""), msg=ret.data)

def testGetNonExistentReleaseBlob(self):
ret = self.client.get("/releases/huetno/data")
self.assertStatusCode(ret, 404)

class TestReleasesAPI_HTML(ViewTest, HTMLTestMixin):

Expand Down

0 comments on commit 1befbec

Please sign in to comment.