Merge "Fix error about request validate for image_search"

This commit is contained in:
Zuul 2018-03-08 10:54:15 +00:00 committed by Gerrit Code Review
commit 478e5c8621
2 changed files with 7 additions and 5 deletions

View File

@ -144,8 +144,8 @@ class Manager(object):
url = "%s?%s" % (url, urlparse.urlencode(qparams))
self.api.raw_request('DELETE', url)
def _search(self, url, body=None, response_key=None, obj_class=None,
qparams=None):
def _search(self, url, qparams=None, response_key=None, obj_class=None,
body=None):
if qparams:
url = "%s?%s" % (url, urlparse.urlencode(qparams))

View File

@ -91,7 +91,8 @@ fake_responses = {
{'images': [IMAGE2, IMAGE1]},
),
},
'/v1/images/%s/search' % IMAGE3['image']:
'/v1/images/%s/search?image_driver=%s' % (IMAGE3['image'],
IMAGE3['image_driver']):
{
'GET': (
{},
@ -182,9 +183,10 @@ class ImageManagerTest(testtools.TestCase):
def test_image_search(self):
images = self.mgr.search_image(**SEARCH_IMAGE)
url = '/v1/images/%s/search?image_driver=%s' \
% (IMAGE3['image'], IMAGE3['image_driver'])
expect = [
('GET', '/v1/images/%s/search' % IMAGE3['image'], {},
{'image_driver': IMAGE3['image_driver']}),
('GET', url, {}, None),
]
self.assertEqual(expect, self.api.calls)
self.assertThat(images, matchers.HasLength(1))