Merge "add unittest for list image members interface"

This commit is contained in:
Zuul 2019-12-12 11:11:34 +00:00 committed by Gerrit Code Review
commit 83c606135b

View File

@ -27,6 +27,28 @@ class TestImageMembersClient(base.BaseServiceTest):
"schema": "/v2/schemas/member" "schema": "/v2/schemas/member"
} }
FAKE_LIST_IMAGE_MEMBERS = {
"members": [
{
"created_at": "2013-10-07T17:58:03Z",
"image_id": "dbc999e3-c52f-4200-bedd-3b18fe7f87fe",
"member_id": "123456789",
"schema": "/v2/schemas/member",
"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",
"schema": "/v2/schemas/member",
"status": "accepted",
"updated_at": "2013-10-08T12:08:55Z"
}
],
"schema": "/v2/schemas/members"
}
def setUp(self): def setUp(self):
super(TestImageMembersClient, self).setUp() super(TestImageMembersClient, self).setUp()
fake_auth = fake_auth_provider.FakeAuthProvider() fake_auth = fake_auth_provider.FakeAuthProvider()
@ -34,6 +56,14 @@ class TestImageMembersClient(base.BaseServiceTest):
'image', 'image',
'regionOne') '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="dbc999e3-c52f-4200-bedd-3b18fe7f87fe")
def _test_show_image_member(self, bytes_body=False): def _test_show_image_member(self, bytes_body=False):
self.check_service_client_function( self.check_service_client_function(
self.client.show_image_member, self.client.show_image_member,
@ -62,6 +92,12 @@ class TestImageMembersClient(base.BaseServiceTest):
member_id="8989447062e04a818baf9e073fd04fa7", member_id="8989447062e04a818baf9e073fd04fa7",
schema="/v2/schemas/member2") schema="/v2/schemas/member2")
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_show_image_member_with_str_body(self): def test_show_image_member_with_str_body(self):
self._test_show_image_member() self._test_show_image_member()