From 1ef4a95ed6e4c6a7dfbb8769f42b933c00d78754 Mon Sep 17 00:00:00 2001 From: Fei Long Wang Date: Sat, 14 Nov 2015 23:22:04 +1300 Subject: [PATCH] Add `flavor` support for v2 This patch is targeting for the library layer, the cli support will be tracked by another patch. Change-Id: I284db15b66360f4bae317239a90743b4965bd016 --- tests/functional/queues/v2/test_flavor.py | 26 +++++++++++++++++++++++ tests/unit/queues/v2/test_flavor.py | 25 ++++++++++++++++++++++ zaqarclient/queues/v2/core.py | 5 +++++ zaqarclient/queues/v2/flavor.py | 20 +++++++++++++++++ zaqarclient/tests/queues/flavor.py | 8 +++++++ 5 files changed, 84 insertions(+) create mode 100644 tests/functional/queues/v2/test_flavor.py create mode 100644 tests/unit/queues/v2/test_flavor.py create mode 100644 zaqarclient/queues/v2/flavor.py diff --git a/tests/functional/queues/v2/test_flavor.py b/tests/functional/queues/v2/test_flavor.py new file mode 100644 index 00000000..942b64ef --- /dev/null +++ b/tests/functional/queues/v2/test_flavor.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 flavor +from zaqarclient.transport import http + + +class QueuesV2FlavorHttpFunctionalTest(flavor.QueuesV2FlavorFunctionalTest): + + is_functional = True + transport_cls = http.HttpTransport + url = 'http://127.0.0.1:8888' + version = 2 diff --git a/tests/unit/queues/v2/test_flavor.py b/tests/unit/queues/v2/test_flavor.py new file mode 100644 index 00000000..dd19a3cc --- /dev/null +++ b/tests/unit/queues/v2/test_flavor.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 flavor +from zaqarclient.transport import http + + +class QueuesV2FlavorHttpUnitTest(flavor.QueuesV2FlavorUnitTest): + + 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 bb566f36..409201ea 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 +flavor_get = core.flavor_get +flavor_create = core.flavor_create +flavor_delete = core.flavor_delete +flavor_update = core.flavor_update +flavor_list = core.flavor_list def signed_url_create(transport, request, queue_name, paths=None, diff --git a/zaqarclient/queues/v2/flavor.py b/zaqarclient/queues/v2/flavor.py new file mode 100644 index 00000000..14b8151b --- /dev/null +++ b/zaqarclient/queues/v2/flavor.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 flavor + + +class Flavor(flavor.Flavor): + pass diff --git a/zaqarclient/tests/queues/flavor.py b/zaqarclient/tests/queues/flavor.py index cd76bd69..5ae8b9f3 100644 --- a/zaqarclient/tests/queues/flavor.py +++ b/zaqarclient/tests/queues/flavor.py @@ -191,3 +191,11 @@ class QueuesV1_1FlavorFunctionalTest(base.QueuesTestBase): flavor_data = {'pool': 'us'} flavor = self.client.flavor('tasty', **flavor_data) flavor.delete() + + +class QueuesV2FlavorUnitTest(QueuesV1_1FlavorUnitTest): + pass + + +class QueuesV2FlavorFunctionalTest(QueuesV1_1FlavorFunctionalTest): + pass