Example #1
0
    def create_accounts(self, account, target_platform_type):
        target_platform = uforge.TargetPlatform()
        target_platform.name = "targetPlatformName"
        target_platform.type = target_platform_type

        account.targetPlatform = target_platform

        accounts = uforge.CredAccounts()
        accounts.credAccounts = pyxb.BIND()
        accounts.credAccounts.append(account)
        return accounts
Example #2
0
    def test_retrieve_account_from_platform_raise_exception_when_no_accounts(self, mock_api_get_all):
        # given
        api = Api("url", username="******", password="******", headers=None,
                  disable_ssl_certificate_validation=False, timeout=constants.HTTP_TIMEOUT)
        accounts = uforge.CredAccounts()
        accounts.credAccounts = pyxb.BIND()
        mock_api_get_all.return_value = accounts

        # when
        with self.assertRaises(Exception) as e:
            migration_utils.retrieve_account(api, "login", "account")

        # then
        self.assertTrue("No CredAccounts available.\n You can use the command 'hammr account create' to create an account." in e.exception)