当前位置: 首页>>代码示例>>Python>>正文


Python User.list方法代码示例

本文整理汇总了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
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:33,代码来源:test_delete_account.py

示例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))
开发者ID:Accelerite,项目名称:cloudstack,代码行数:10,代码来源:test_nuage_non_public_sharednetwork_ip_range.py

示例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
开发者ID:wilderrodrigues,项目名称:cloudstack_integration_tests,代码行数:78,代码来源:test_accounts.py


注:本文中的marvin.lib.base.User.list方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。