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

Source Code for Module yakumo.smoketests.st11_v2_service_endpoint_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 v2 Test (Services/Endpoints)""" 
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'] != '2.0': 33 return 34 35 LOG.info("Create Service #1") 36 name = get_random_str('service') 37 with c.service.create(name=name, 38 type='type1', 39 description='service 1', 40 is_enabled=False) as s: 41 42 test("Service #1: name is %s" % name, s.name == name) 43 test("Service #1: type is 'type1'", s.type == 'type1') 44 test("Service #1: description is 'service 1'", 45 s.description == 'service 1') 46 test("Service #1: is disabled", not s.is_enabled) 47 48 LOG.info("Create Endpoints") 49 name = get_random_str('endpoint') 50 region_name = get_random_str('region') 51 public_url = 'http://%s/v1/public' % name 52 internal_url = 'http://%s/v1/internal' % name 53 admin_url = 'http://%s/v1/admin' % name 54 with c.endpoint.create(public_url=public_url, 55 internal_url=internal_url, 56 admin_url=admin_url, 57 region=region_name, 58 service=s, 59 is_enabled=False) as e: 60 61 test("Endpoints #1: service is %s" % s.name, e.service == s) 62 test("Endpoints #1: region name is %s" % region_name, 63 e.region == region_name) 64 test("Endpoints #1: public_url is %s" % public_url, 65 e.public_url == public_url) 66 test("Endpoints #1: internal_url is %s" % internal_url, 67 e.internal_url == internal_url) 68 test("Endpoints #1: admin_url is %s" % admin_url, 69 e.admin_url == admin_url) 70 test("Endpoints #1: is disabled", not e.is_enabled)
71 72 73 if __name__ == '__main__': 74 c = utils.get_client() 75 if c._session.config[u'identity_api_version'] != '2.0': 76 sys.exit(0) 77 78 LOG.debug("list services: %s", [_.name for _ in c.service.list()]) 79 LOG.debug("list endpoints: %s", c.endpoint.list()) 80 main(c) 81 LOG.debug("list services: %s", [_.name for _ in c.service.list()]) 82 LOG.debug("list endpoints: %s", c.endpoint.list()) 83 84 show_test_summary() 85