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
13from openstack.block_storage.v3 import group_type
14from openstack.tests.unit import base
15
16GROUP_TYPE = {
17    "id": "6685584b-1eac-4da6-b5c3-555430cf68ff",
18    "name": "grp-type-001",
19    "description": "group type 001",
20    "is_public": True,
21    "group_specs": {
22        "consistent_group_snapshot_enabled": "<is> False"
23    }
24}
25
26
27class TestGroupType(base.TestCase):
28
29    def test_basic(self):
30        resource = group_type.GroupType()
31        self.assertEqual("group_type", resource.resource_key)
32        self.assertEqual("group_types", resource.resources_key)
33        self.assertEqual("/group_types", resource.base_path)
34        self.assertTrue(resource.allow_create)
35        self.assertTrue(resource.allow_fetch)
36        self.assertTrue(resource.allow_delete)
37        self.assertTrue(resource.allow_commit)
38        self.assertTrue(resource.allow_list)
39
40    def test_make_resource(self):
41        resource = group_type.GroupType(**GROUP_TYPE)
42        self.assertEqual(GROUP_TYPE["id"], resource.id)
43        self.assertEqual(GROUP_TYPE["name"], resource.name)
44        self.assertEqual(GROUP_TYPE["description"], resource.description)
45        self.assertEqual(GROUP_TYPE["is_public"], resource.is_public)
46        self.assertEqual(GROUP_TYPE["group_specs"], resource.group_specs)
47