blob: dbb8c5846787e62a1784f25f5a48356ec8f2871b [file] [log] [blame]
lkuchlan3bd6e272018-01-25 11:16:10 +02001# Copyright 2018 Red Hat, Inc.
2# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
16from tempest.api.image import base
17from tempest.lib.common.utils import data_utils
18from tempest.lib import decorators
19
20
21class BasicOperationsImagesAdminTest(base.BaseV2ImageAdminTest):
22
23 @decorators.related_bug('1420008')
24 @decorators.idempotent_id('646a6eaa-135f-4493-a0af-12583021224e')
25 def test_create_image_owner_param(self):
26 # NOTE: Create image with owner different from tenant owner by
27 # using "owner" parameter requires an admin privileges.
28 random_id = data_utils.rand_uuid_hex()
29 image = self.admin_client.create_image(
30 container_format='bare', disk_format='raw', owner=random_id)
31 self.addCleanup(self.admin_client.delete_image, image['id'])
32 image_info = self.admin_client.show_image(image['id'])
33 self.assertEqual(random_id, image_info['owner'])
lkuchlanf8ff1ff2018-02-07 11:29:54 +020034
35 @decorators.related_bug('1420008')
36 @decorators.idempotent_id('525ba546-10ef-4aad-bba1-1858095ce553')
37 def test_update_image_owner_param(self):
38 random_id_1 = data_utils.rand_uuid_hex()
39 image = self.admin_client.create_image(
40 container_format='bare', disk_format='raw', owner=random_id_1)
41 self.addCleanup(self.admin_client.delete_image, image['id'])
42 created_image_info = self.admin_client.show_image(image['id'])
43
44 random_id_2 = data_utils.rand_uuid_hex()
45 self.admin_client.update_image(
46 image['id'], [dict(replace="/owner", value=random_id_2)])
47 updated_image_info = self.admin_client.show_image(image['id'])
48
49 self.assertEqual(random_id_2, updated_image_info['owner'])
50 self.assertNotEqual(created_image_info['owner'],
51 updated_image_info['owner'])