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

Source Code for Module yakumo.smoketests.st14_v3_project_on_project_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 Projects)""" 
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 Domain #1") 36 name = get_random_str('domain') 37 with c.domain.create(name=name, 38 description='domain 1', 39 is_enabled=True) as d: 40 41 test("Doamin #1: name is %s" % name, d.name == name) 42 43 LOG.info("Create Project #1") 44 name = get_random_str('project') 45 with c.project.create(name=name, 46 description='project 1', 47 domain=d, 48 is_enabled=True) as p1: 49 50 test("Project #1: name is %s" % name, p1.name == name) 51 52 LOG.info("Create Project #2") 53 name = get_random_str('project') 54 with c.project.create(name=name, 55 description='project 2', 56 domain=d, 57 parent=p1, 58 is_enabled=False) as p2: 59 60 test("Project #2: name is %s" % name, p2.name == name) 61 test("Project #2: description is 'project 2'", 62 p2.description == 'project 2') 63 test("Project #2: is disabled", not p2.is_enabled) 64 test("Project #2: parent is Project #2", 65 p2.parent == p1) 66 67 LOG.debug("Domain #1: disabled to delete") 68 d.update(is_enabled=False)
69 70 71 if __name__ == '__main__': 72 c = utils.get_client() 73 if c._session.config[u'identity_api_version'] != '3': 74 sys.exit(0) 75 76 LOG.debug("list domains: %s", [_.name for _ in c.domain.list()]) 77 LOG.debug("list projects: %s", [_.name for _ in c.project.list()]) 78 main(c) 79 LOG.debug("list domains: %s", [_.name for _ in c.domain.list()]) 80 LOG.debug("list projects: %s", [_.name for _ in c.project.list()]) 81 82 show_test_summary() 83