Start adding support for v1.1

This patch adds basic support for the API version 1.1. It basically
re-uses the specs and implementations from v1 since the API hasn't
really changed much.

Future patches will add support for the new methods and other changes.

Partially-Implements blueprint: api-v1.1

Change-Id: I40d02d6c2d3b932725f35204708d79785f59116b
This commit is contained in:
Flavio Percoco 2014-09-09 15:35:02 +02:00
parent ed364770fc
commit 0a125f7bc2
8 changed files with 43 additions and 6 deletions

View File

@ -37,8 +37,12 @@ zaqarclient.transport =
http.v1 = zaqarclient.transport.http:HttpTransport http.v1 = zaqarclient.transport.http:HttpTransport
https.v1 = zaqarclient.transport.http:HttpTransport https.v1 = zaqarclient.transport.http:HttpTransport
http.v1.1 = zaqarclient.transport.http:HttpTransport
https.v1.1 = zaqarclient.transport.http:HttpTransport
zaqarclient.api = zaqarclient.api =
queues.v1 = zaqarclient.queues.v1.api:V1 queues.v1 = zaqarclient.queues.v1.api:V1
queues.v1.1 = zaqarclient.queues.v1.api:V1_1
openstack.queuing.v1 = openstack.queuing.v1 =
queue_list = zaqarclient.queues.v1.cli:ListQueues queue_list = zaqarclient.queues.v1.cli:ListQueues

View File

@ -13,3 +13,5 @@ nose-exclude
openstack.nose_plugin>=0.7 openstack.nose_plugin>=0.7
# Metrics and style # Metrics and style
coverage>=3.6 coverage>=3.6
ddt>=0.4.0

View File

@ -23,3 +23,10 @@ class QueuesV1ClaimsHttpUnitTest(claims.QueueV1ClaimUnitTest):
transport_cls = http.HttpTransport transport_cls = http.HttpTransport
url = 'http://127.0.0.1:8888/v1' url = 'http://127.0.0.1:8888/v1'
version = 1 version = 1
class QueuesV1_1ClaimsHttpUnitTest(claims.QueueV1ClaimUnitTest):
transport_cls = http.HttpTransport
url = 'http://127.0.0.1:8888/v1.1'
version = 1.1

View File

@ -15,24 +15,29 @@
import mock import mock
import ddt
from zaqarclient.queues import client from zaqarclient.queues import client
from zaqarclient.queues.v1 import core from zaqarclient.queues.v1 import core
from zaqarclient.tests import base from zaqarclient.tests import base
from zaqarclient.transport import response from zaqarclient.transport import response
VERSION = 1 VERSIONS = [1, 1.1]
@ddt.ddt
class TestClient(base.TestBase): class TestClient(base.TestBase):
def test_transport(self): @ddt.data(*VERSIONS)
def test_transport(self, version):
cli = client.Client('http://example.com', cli = client.Client('http://example.com',
VERSION, {}) version, {})
self.assertIsNotNone(cli.transport()) self.assertIsNotNone(cli.transport())
def test_health(self): @ddt.data(*VERSIONS)
def test_health(self, version):
cli = client.Client('http://example.com', cli = client.Client('http://example.com',
VERSION, {}) version, {})
with mock.patch.object(core, 'health', autospec=True) as core_health: with mock.patch.object(core, 'health', autospec=True) as core_health:
resp = response.Response(None, None) resp = response.Response(None, None)
core_health.return_value = resp core_health.return_value = resp

View File

@ -109,3 +109,10 @@ class QueuesV1MessageHttpUnitTest(test_message.QueuesV1MessageUnitTest):
transport_cls = http.HttpTransport transport_cls = http.HttpTransport
url = 'http://127.0.0.1:8888/v1' url = 'http://127.0.0.1:8888/v1'
version = 1 version = 1
class QueuesV1_1MessageHttpUnitTest(test_message.QueuesV1MessageUnitTest):
transport_cls = http.HttpTransport
url = 'http://127.0.0.1:8888/v1.1'
version = 1.1

View File

@ -23,3 +23,10 @@ class QueuesV1QueueHttpUnitTest(queues.QueuesV1QueueUnitTest):
transport_cls = http.HttpTransport transport_cls = http.HttpTransport
url = 'http://127.0.0.1:8888/v1' url = 'http://127.0.0.1:8888/v1'
version = 1 version = 1
class QueuesV1_1QueueHttpUnitTest(queues.QueuesV1QueueUnitTest):
transport_cls = http.HttpTransport
url = 'http://127.0.0.1:8888/v1.1'
version = 1.1

View File

@ -16,7 +16,8 @@
from zaqarclient import errors from zaqarclient import errors
from zaqarclient.queues.v1 import client as cv1 from zaqarclient.queues.v1 import client as cv1
_CLIENTS = {1: cv1.Client} _CLIENTS = {1: cv1.Client,
1.1: cv1.Client}
def Client(url=None, version=None, conf=None): def Client(url=None, version=None, conf=None):

View File

@ -210,3 +210,7 @@ class V1(api.Api):
'method': 'GET', 'method': 'GET',
}, },
} }
class V1_1(V1):
label = 'v1.1'