Skip to content

Commit 0e8aa79

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "Add functional tests for image metadef resource type list"
2 parents 3b6f9ee + 6b6a9ba commit 0e8aa79

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
13+
import uuid
14+
15+
from openstackclient.tests.functional.image import base
16+
17+
18+
class ImageMetadefResourceTypeTests(base.BaseImageTests):
19+
"""Functional tests for image metadef resource type commands."""
20+
21+
def setUp(self):
22+
super().setUp()
23+
24+
# Create unique namespace name using UUID
25+
self.namespace_name = 'test-mdef-ns-' + uuid.uuid4().hex
26+
self.resource_type_name = 'test-mdef-rt-' + uuid.uuid4().hex
27+
28+
# Create namespace
29+
self.openstack('image metadef namespace create ' + self.namespace_name)
30+
self.addCleanup(
31+
self.openstack,
32+
'image metadef namespace delete ' + self.namespace_name,
33+
)
34+
35+
def test_metadef_resource_type(self):
36+
"""Test image metadef resource type commands"""
37+
38+
self.openstack(
39+
'image metadef resource type association create '
40+
f'{self.namespace_name} {self.resource_type_name}',
41+
)
42+
self.addCleanup(
43+
self.openstack,
44+
'image metadef resource type association delete '
45+
f'{self.namespace_name} {self.resource_type_name}',
46+
)
47+
48+
output = self.openstack(
49+
'image metadef resource type list',
50+
parse_output=True,
51+
)
52+
53+
self.assertIn(
54+
self.resource_type_name, [item['Name'] for item in output]
55+
)

0 commit comments

Comments
 (0)