本文整理汇总了Python中pyvcloud.system_test_framework.environment.Environment.get_user_href_in_test_org方法的典型用法代码示例。如果您正苦于以下问题:Python Environment.get_user_href_in_test_org方法的具体用法?Python Environment.get_user_href_in_test_org怎么用?Python Environment.get_user_href_in_test_org使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.system_test_framework.environment.Environment
的用法示例。
在下文中一共展示了Environment.get_user_href_in_test_org方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_0090_change_vapp_owner
# 需要导入模块: from pyvcloud.system_test_framework.environment import Environment [as 别名]
# 或者: from pyvcloud.system_test_framework.environment.Environment import get_user_href_in_test_org [as 别名]
def test_0090_change_vapp_owner(self):
"""Test the method vapp.change_owner().
This test passes if the owner of the vApp is successfuly changed to the
desired user.
"""
try:
logger = Environment.get_default_logger()
org_admin_client = Environment.get_client_in_default_org(
CommonRoles.ORGANIZATION_ADMINISTRATOR)
vapp_name = TestVApp._empty_vapp_name
vapp = Environment.get_vapp_in_test_vdc(
client=org_admin_client, vapp_name=vapp_name)
vapp_user_name = Environment.get_username_for_role_in_test_org(
CommonRoles.VAPP_USER)
vapp_user_href = Environment.get_user_href_in_test_org(
vapp_user_name)
logger.debug('Changing owner of vApp ' + vapp_name + ' to ' +
vapp_user_name)
vapp.change_owner(vapp_user_href)
vapp.reload()
self.assertEqual(vapp.get_resource().Owner.User.get('name'),
vapp_user_name)
logger.debug('Changing owner of vApp ' + vapp_name + ' back to ' +
TestVApp._empty_vapp_owner_name)
original_owner_href = Environment.get_user_href_in_test_org(
TestVApp._empty_vapp_owner_name)
vapp.change_owner(original_owner_href)
vapp.reload()
self.assertEqual(vapp.get_resource().Owner.User.get('name'),
TestVApp._empty_vapp_owner_name)
finally:
org_admin_client.logout()