Merge "Raising 400 Bad Request when using "changes-since" filter on v2"

This commit is contained in:
Jenkins 2014-07-19 04:10:15 +00:00 committed by Gerrit Code Review
commit a28db383fc
2 changed files with 13 additions and 0 deletions

View File

@ -518,6 +518,10 @@ class RequestDeserializer(wsgi.JSONRequestDeserializer):
if visibility not in ['public', 'private', 'shared']:
msg = _('Invalid visibility value: %s') % visibility
raise webob.exc.HTTPBadRequest(explanation=msg)
changes_since = filters.get('changes-since', None)
if changes_since:
msg = _('The "changes-since" filter is no longer available on v2.')
raise webob.exc.HTTPBadRequest(explanation=msg)
return filters

View File

@ -202,6 +202,15 @@ class TestImages(functional.FunctionalTest):
self.assertEqual(1, len(images))
self.assertEqual(images[0]['id'], image_id)
# The "changes-since" filter shouldn't work on glance v2
path = self._url('/v2/images?changes-since=20001007T10:10:10')
response = requests.get(path, headers=self._headers())
self.assertEqual(400, response.status_code)
path = self._url('/v2/images?changes-since=aaa')
response = requests.get(path, headers=self._headers())
self.assertEqual(400, response.status_code)
# Image list should list only image-1 based on the filter
# 'foo=bar&abc=xyz'
path = self._url('/v2/images?foo=bar&abc=xyz')