CLOUDSTACK-10014: fix components/test_accounts.py test_user_key_renew_same_account: use new api getUserKeys to get secrett key

This commit is contained in:
Boris 2017-07-24 17:54:41 +03:00 committed by Rohit Yadav
parent 055ae078ec
commit 899c5c784d
1 changed files with 20 additions and 0 deletions

View File

@ -20,6 +20,7 @@
from marvin.cloudstackTestCase import cloudstackTestCase
from marvin.lib.utils import (random_gen,
cleanup_resources)
from marvin.cloudstackAPI import *
from marvin.lib.base import (Domain,
Account,
ServiceOffering,
@ -43,6 +44,8 @@ from nose.plugins.attrib import attr
from marvin.cloudstackException import CloudstackAPIException
import time
from pyVmomi.VmomiSupport import GetVersionFromVersionUri
class Services:
@ -1653,6 +1656,11 @@ class TestUserAPIKeys(cloudstackTestCase):
user.apikey,
userkeys.apikey,
"Check User api key")
user.secretkey = self.get_secret_key(user.id)
self.assertEqual(
user.secretkey,
userkeys.secretkey,
"Check User having secret key")
self.debug("Get test client with user keys")
cs_api = self.testClient.getUserApiClient(
@ -1664,6 +1672,17 @@ class TestUserAPIKeys(cloudstackTestCase):
userkeys.apikey,
new_keys.apikey,
"Check API key is different")
new_keys.secretkey = self.get_secret_key(user_1.id)
self.assertNotEqual(
userkeys.secretkey,
new_keys.secretkey,
"Check secret key is different")
def get_secret_key(self, id):
cmd = getUserKeys.getUserKeysCmd()
cmd.id = id
keypair = self.apiclient.getUserKeys(cmd)
return keypair.secretkey
@attr(tags=[
"role",
@ -2062,3 +2081,4 @@ class TestDomainForceRemove(cloudstackTestCase):
with self.assertRaises(Exception):
domain.delete(self.apiclient, cleanup=False)
return