本文整理匯總了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