Advertisement
Guest User

Untitled

a guest
May 12th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. @validation.required_openstack(admin=True)
  2. @scenario.configure(context={"admin_cleanup": ["keystone"]})
  3. def project_admin_is_cloud_admin(self, **kwargs):
  4. admin = self.admin_clients("keystone", version=3)
  5.  
  6. new_domain = admin.domains.create("domain-1")
  7. print new_domain.id
  8. new_domain_admin = admin.users.create(
  9. name="user-1", password="password", domain=new_domain.id)
  10. admin_role = admin.roles.find(name="admin")
  11. admin.roles.grant(admin_role, user=new_domain_admin, domain=new_domain)
  12.  
  13. from keystoneauth1.identity import v3 as id_v3
  14. auth = id_v3.Password(user_domain_name="domain-1", username="user-1", domain_name="domain-1", password="password", project_domain_name="domain-1", auth_url=self.admin_clients("keystone", version=3).auth_url)
  15. from keystoneauth1 import session
  16. from keystoneclient.v3 import client
  17. sess = session.Session(auth=auth)
  18. keystone = client.Client(session=sess)
  19. print keystone
  20. keystone.projects.create('test', domain='default')
  21. print admin.projects.list()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement