本文整理汇总了Python中marvin.lib.base.User.list方法的典型用法代码示例。如果您正苦于以下问题:Python User.list方法的具体用法?Python User.list怎么用?Python User.list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类marvin.lib.base.User
的用法示例。
在下文中一共展示了User.list方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_01_getsecretkey
# 需要导入模块: from marvin.lib.base import User [as 别名]
# 或者: from marvin.lib.base.User import list [as 别名]
def test_01_getsecretkey(self):
"""Test if we can get the secretkey"""
userkeys = None
userinfo = None
try:
userkeys = User.registerUserKeys(self.apiclient, self.account.user[0].id)
except CloudstackAPIException:
self.logger.debug("Registered user keys")
except Exception as e:
self.logger.debug("Exception %s raised while registering user keys" % e)
try:
userinfo = User.list(self.apiclient, id=self.account.user[0].id)[0]
except CloudstackAPIException:
self.logger.debug("Retrieved user")
except Exception as e:
self.logger.debug("Exception %s raised while retrieving user" % e)
self.assertEqual(
userkeys.apikey,
userinfo.apikey,
"API key is different"
)
self.assertNotEqual(
userkeys.secretkey,
userinfo.secretkey,
"Secret key is visible"
)
return
示例2: generateKeysForUser
# 需要导入模块: from marvin.lib.base import User [as 别名]
# 或者: from marvin.lib.base.User import list [as 别名]
def generateKeysForUser(api_client, account):
user = User.list(
api_client,
account=account.name,
domainid=account.domainid)[0]
return (User.registerUserKeys(
api_client,
user.id))
示例3: test_updateDomainAdminDetails
# 需要导入模块: from marvin.lib.base import User [as 别名]
# 或者: from marvin.lib.base.User import list [as 别名]
def test_updateDomainAdminDetails(self):
"""Test update domain admin details
"""
# Steps for test scenario
# 2. update the user details (firstname, lastname, user) with
# updateUser API
# 3. listUsers in the account
# 4. delete the account
# Validate the following
# 1. listAccounts should show account created successfully
# 2. updateUser API should return valid response
# 3. user should be updated with new details
self.debug("Creating a domain admin account")
self.account = Account.create(
self.apiclient,
self.services["account"],
admin=True,
domainid=self.domain.id
)
self._cleanup.append(self.account)
# Fetching the user details of account
self.debug(
"Fetching user details for account: %s" %
self.account.name)
users = User.list(
self.apiclient,
account=self.account.name,
domainid=self.account.domainid
)
self.assertEqual(
isinstance(users, list),
True,
"List users should return a valid list for account"
)
user_1 = users[0]
self.debug("Updating the details of user: %s" % user_1.name)
firstname = random_gen()
lastname = random_gen()
self.debug("New firstname: %s, lastname: %s" % (firstname, lastname))
User.update(
self.apiclient,
user_1.id,
firstname=firstname,
lastname=lastname
)
# Fetching the user details of account
self.debug(
"Fetching user details for user: %s" % user_1.name)
users = User.list(
self.apiclient,
id=user_1.id,
listall=True
)
self.assertEqual(
isinstance(users, list),
True,
"List users should return a valid list for account"
)
user_1 = users[0]
self.assertEqual(
user_1.firstname,
firstname,
"User's first name should be updated with new one"
)
self.assertEqual(
user_1.lastname,
lastname,
"User's last name should be updated with new one"
)
return