'Test image download returns HTTPBadRequest.
Make sure that serializer returns 400 bad request error in case of
getting randomly images from this store is not supported at
specified location.'

def test_download_store_random_get_not_support(self):

    with mock.patch.object(glance.api.policy.ImageProxy, 'get_data') as m_get_data:
        err = glance_store.StoreRandomGetNotSupported(offset=0, chunk_size=0)
        m_get_data.side_effect = err
        request = wsgi.Request.blank('/')
        response = webob.Response()
        response.request = request
        image = FakeImage(size=3, data=iter('ZZZ'))
        image.get_data = m_get_data
        self.assertRaises(webob.exc.HTTPBadRequest, self.serializer.download, response, image)
