From b0d412ed2c16af3a1d977c7159b5d04c70ed9662 Mon Sep 17 00:00:00 2001 From: Fei Long Wang Date: Sat, 14 Nov 2015 22:49:54 +1300 Subject: [PATCH] Add `pool` support for v2 This patch is targeting for the library layer, the cli support will be tracked by another patch. Change-Id: Ic0a44a5d3e0990cf065c4f959e4ef76712ce1882 --- tests/functional/queues/v2/test_pool.py | 26 +++++++++++++++++++++++++ tests/unit/queues/v2/test_pool.py | 25 ++++++++++++++++++++++++ zaqarclient/queues/v2/core.py | 5 +++++ zaqarclient/queues/v2/pool.py | 20 +++++++++++++++++++ zaqarclient/tests/queues/pool.py | 8 ++++++++ 5 files changed, 84 insertions(+) create mode 100644 tests/functional/queues/v2/test_pool.py create mode 100644 tests/unit/queues/v2/test_pool.py create mode 100644 zaqarclient/queues/v2/pool.py diff --git a/tests/functional/queues/v2/test_pool.py b/tests/functional/queues/v2/test_pool.py new file mode 100644 index 00000000..5589a1cd --- /dev/null +++ b/tests/functional/queues/v2/test_pool.py @@ -0,0 +1,26 @@ +# Copyright (c) 2014 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from zaqarclient.tests.queues import pool +from zaqarclient.transport import http + + +class QueuesV2PoolHttpFunctionalTest(pool.QueuesV2PoolFunctionalTest): + + is_functional = True + transport_cls = http.HttpTransport + url = 'http://127.0.0.1:8888' + version = 2 diff --git a/tests/unit/queues/v2/test_pool.py b/tests/unit/queues/v2/test_pool.py new file mode 100644 index 00000000..0b0eeacb --- /dev/null +++ b/tests/unit/queues/v2/test_pool.py @@ -0,0 +1,25 @@ +# Copyright (c) 2014 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +from zaqarclient.tests.queues import pool +from zaqarclient.transport import http + + +class QueuesV2PoolHttpUnitTest(pool.QueuesV2PoolUnitTest): + + transport_cls = http.HttpTransport + url = 'http://127.0.0.1:8888/v2' + version = 2 diff --git a/zaqarclient/queues/v2/core.py b/zaqarclient/queues/v2/core.py index 409201ea..5cd471a4 100644 --- a/zaqarclient/queues/v2/core.py +++ b/zaqarclient/queues/v2/core.py @@ -46,6 +46,11 @@ message_list = core.message_list message_post = core.message_post message_delete = core.message_delete message_delete_many = core.message_delete_many +pool_get = core.pool_get +pool_create = core.pool_create +pool_delete = core.pool_delete +pool_update = core.pool_update +pool_list = core.pool_list flavor_get = core.flavor_get flavor_create = core.flavor_create flavor_delete = core.flavor_delete diff --git a/zaqarclient/queues/v2/pool.py b/zaqarclient/queues/v2/pool.py new file mode 100644 index 00000000..38650521 --- /dev/null +++ b/zaqarclient/queues/v2/pool.py @@ -0,0 +1,20 @@ +# Copyright (c) 2015 Catalyst IT Ltd. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from zaqarclient.queues.v1 import pool + + +class Pool(pool.Pool): + pass diff --git a/zaqarclient/tests/queues/pool.py b/zaqarclient/tests/queues/pool.py index 15b15614..c2629ce4 100644 --- a/zaqarclient/tests/queues/pool.py +++ b/zaqarclient/tests/queues/pool.py @@ -175,3 +175,11 @@ class QueuesV1_1PoolFunctionalTest(base.QueuesTestBase): pool = self.client.pool('test', **pool_data) pool.delete() + + +class QueuesV2PoolUnitTest(QueuesV1PoolUnitTest): + pass + + +class QueuesV2PoolFunctionalTest(QueuesV1_1PoolFunctionalTest): + pass