Fix v2 requests to non-bleeding edge servers
In the case where v2 requests are sent to a server which is not running head of tree which includes the v2 metadef code some 404 cases need to be handled to enable standard requests to complete. This patch aslo improves fetching schemas -- they are now only fetched as needed. Change-Id: I8c871f11b909337bd7df19b77e606772dbc634b2 Closes-bug: #1367326
This commit is contained in:
committed by
Stuart McLaren
parent
fde99a0a4d
commit
97b1506bdb
@@ -18,6 +18,8 @@ import json
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from glanceclient.v2.schemas import Schema
|
||||
|
||||
|
||||
class FakeAPI(object):
|
||||
def __init__(self, fixtures):
|
||||
@@ -60,6 +62,15 @@ class FakeAPI(object):
|
||||
return self._request('HEAD', *args, **kwargs)
|
||||
|
||||
|
||||
class FakeSchemaAPI(FakeAPI):
|
||||
def __init__(cls, *args):
|
||||
super(FakeSchemaAPI, cls).__init__(*args)
|
||||
|
||||
def get(self, *args, **kwargs):
|
||||
_, raw_schema = self._request('GET', *args, **kwargs)
|
||||
return Schema(raw_schema)
|
||||
|
||||
|
||||
class RawRequest(object):
|
||||
def __init__(self, headers, body=None,
|
||||
version=1.0, status=200, reason="Ok"):
|
||||
|
||||
Reference in New Issue
Block a user