Merge "Define v1 image_members_client as library"
This commit is contained in:
commit
682da859d0
@ -6,6 +6,7 @@ features:
|
||||
so the other projects can use these modules as stable libraries
|
||||
without any maintenance changes.
|
||||
|
||||
* image_members_client(v1)
|
||||
* image_members_client(v2)
|
||||
* images_client(v2)
|
||||
* namespaces_client(v2)
|
||||
|
@ -76,6 +76,8 @@ from tempest.lib.services.compute.volumes_client import \
|
||||
from tempest.lib.services.identity.v2.endpoints_client import EndpointsClient
|
||||
from tempest.lib.services.identity.v2.token_client import TokenClient
|
||||
from tempest.lib.services.identity.v3.token_client import V3TokenClient
|
||||
from tempest.lib.services.image.v1.image_members_client import \
|
||||
ImageMembersClient
|
||||
from tempest.lib.services.image.v2.image_members_client import \
|
||||
ImageMembersClient as ImageMembersClientV2
|
||||
from tempest.lib.services.image.v2.images_client import \
|
||||
@ -141,8 +143,6 @@ from tempest.services.identity.v3.json.services_client import \
|
||||
from tempest.services.identity.v3.json.trusts_client import TrustsClient
|
||||
from tempest.services.identity.v3.json.users_clients import \
|
||||
UsersClient as UsersV3Client
|
||||
from tempest.services.image.v1.json.image_members_client import \
|
||||
ImageMembersClient
|
||||
from tempest.services.image.v1.json.images_client import ImagesClient
|
||||
from tempest.services.object_storage.account_client import AccountClient
|
||||
from tempest.services.object_storage.container_client import ContainerClient
|
||||
|
0
tempest/lib/services/image/v1/__init__.py
Normal file
0
tempest/lib/services/image/v1/__init__.py
Normal file
0
tempest/tests/lib/services/image/v1/__init__.py
Normal file
0
tempest/tests/lib/services/image/v1/__init__.py
Normal file
@ -0,0 +1,84 @@
|
||||
# Copyright 2016 NEC Corporation. All rights reserved.
|
||||
#
|
||||
# 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 tempest.lib.services.image.v1 import image_members_client
|
||||
from tempest.tests.lib import fake_auth_provider
|
||||
from tempest.tests.lib.services import base
|
||||
|
||||
|
||||
class TestImageMembersClient(base.BaseServiceTest):
|
||||
FAKE_LIST_IMAGE_MEMBERS = {
|
||||
"members": [
|
||||
{
|
||||
"created_at": "2013-10-07T17:58:03Z",
|
||||
"image_id": "dbc999e3-c52f-4200-bedd-3b18fe7f87fe",
|
||||
"member_id": "123456789",
|
||||
"status": "pending",
|
||||
"updated_at": "2013-10-07T17:58:03Z"
|
||||
},
|
||||
{
|
||||
"created_at": "2013-10-07T17:58:55Z",
|
||||
"image_id": "dbc999e3-c52f-4200-bedd-3b18fe7f87fe",
|
||||
"member_id": "987654321",
|
||||
"status": "accepted",
|
||||
"updated_at": "2013-10-08T12:08:55Z"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(TestImageMembersClient, self).setUp()
|
||||
fake_auth = fake_auth_provider.FakeAuthProvider()
|
||||
self.client = image_members_client.ImageMembersClient(fake_auth,
|
||||
'image',
|
||||
'regionOne')
|
||||
|
||||
def _test_list_image_members(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.list_image_members,
|
||||
'tempest.lib.common.rest_client.RestClient.get',
|
||||
self.FAKE_LIST_IMAGE_MEMBERS,
|
||||
bytes_body,
|
||||
image_id="0ae74cc5-5147-4239-9ce2-b0c580f7067e")
|
||||
|
||||
def _test_create_image_member(self, bytes_body=False):
|
||||
self.check_service_client_function(
|
||||
self.client.create_image_member,
|
||||
'tempest.lib.common.rest_client.RestClient.put',
|
||||
{},
|
||||
bytes_body,
|
||||
image_id="0ae74cc5-5147-4239-9ce2-b0c580f7067e",
|
||||
member_id="8989447062e04a818baf9e073fd04fa7",
|
||||
status=204)
|
||||
|
||||
def test_list_image_members_with_str_body(self):
|
||||
self._test_list_image_members()
|
||||
|
||||
def test_list_image_members_with_bytes_body(self):
|
||||
self._test_list_image_members(bytes_body=True)
|
||||
|
||||
def test_create_image_member_with_str_body(self):
|
||||
self._test_create_image_member()
|
||||
|
||||
def test_create_image_member_with_bytes_body(self):
|
||||
self._test_create_image_member(bytes_body=True)
|
||||
|
||||
def test_delete_image_member(self):
|
||||
self.check_service_client_function(
|
||||
self.client.delete_image_member,
|
||||
'tempest.lib.common.rest_client.RestClient.delete',
|
||||
{},
|
||||
image_id="0ae74cc5-5147-4239-9ce2-b0c580f7067e",
|
||||
member_id="8989447062e04a818baf9e073fd04fa7",
|
||||
status=204)
|
Loading…
Reference in New Issue
Block a user