1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """Identity API v3 Test (Hierarchical Regions)"""
18
19
20 import hashlib
21 import os
22 import sys
23 import tempfile
24
25 from yakumo.smoketest import *
26 from yakumo import utils
27
28
30
31
32 if c._session.config[u'identity_api_version'] != '3':
33 return
34
35 LOG.info("Create Region #1")
36 region_id = get_random_str('region')
37 with c.region.create(id=region_id, description='region 1') as r1:
38
39 test("Region #1: id is %s" % region_id, r1.id == region_id)
40
41 LOG.info("Create Region #1")
42 region_id = get_random_str('region')
43 with c.region.create(id=region_id,
44 parent=r1,
45 description='region 2') as r2:
46
47 test("Region #2: id is %s" % region_id, r2.id == region_id)
48 test("Region #2: description is 'region 2'",
49 r2.description == 'region 2')
50 test("Region #2: parent is #1", r2.parent == r1)
51
52 LOG.info("Update Region #2")
53
54 r2.update(parent=None)
55 test("Region #2: no parent", r2.parent is None)
56
57
58 if __name__ == '__main__':
59 c = utils.get_client()
60 if c._session.config[u'identity_api_version'] != '3':
61 sys.exit(0)
62
63 LOG.debug("list regions: %s", c.region.list())
64 main(c)
65 LOG.debug("list regions: %s", c.region.list())
66
67 show_test_summary()
68