Package yakumo :: Package smoketests :: Module st15_v3_region_on_region_admin
[hide private]
[frames] | no frames]

Source Code for Module yakumo.smoketests.st15_v3_region_on_region_admin

 1  #!/usr/bin/env python 
 2  # 
 3  # Copyright 2014-2017 by Akira Yoshiyama <akirayoshiyama@gmail.com>. 
 4  # All Rights Reserved. 
 5  # 
 6  #    Licensed under the Apache License, Version 2.0 (the "License"); you may 
 7  #    not use this file except in compliance with the License. You may obtain 
 8  #    a copy of the License at 
 9  # 
10  #         http://www.apache.org/licenses/LICENSE-2.0 
11  # 
12  #    Unless required by applicable law or agreed to in writing, software 
13  #    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
14  #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
15  #    License for the specific language governing permissions and limitations 
16  #    under the License. 
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   
29 -def main(c):
30 31 # check Identity API version 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