Skip to content

Commit 1b7a100

Browse files
pckreddyyadvr
authored andcommitted
CLOUDSTACK-7996: Fixed the script test_tags.py - Tags and Template should belong to the User Account to test the case
(cherry picked from commit b0d74ad) Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 535c037 commit 1b7a100

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

test/integration/component/test_tags.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,12 @@ def setUpClass(cls):
212212
cls.services["account"],
213213
admin=True,
214214
)
215+
216+
cls.user_api_client = cls.testClient.getUserApiClient(
217+
UserName=cls.account.name,
218+
DomainName=cls.account.domain
219+
)
220+
215221
# Create service offerings, disk offerings etc
216222
cls.service_offering = ServiceOffering.create(
217223
cls.api_client,
@@ -943,14 +949,14 @@ def test_06_template_tag(self):
943949
try:
944950
self.debug("Stopping the virtual machine: %s" % self.vm_1.name)
945951
#Stop virtual machine
946-
self.vm_1.stop(self.apiclient)
952+
self.vm_1.stop(self.user_api_client)
947953
except Exception as e:
948954
self.fail("Failed to stop VM: %s" % e)
949955

950956
timeout = self.services["timeout"]
951957
while True:
952958
list_volume = Volume.list(
953-
self.apiclient,
959+
self.user_api_client,
954960
virtualmachineid=self.vm_1.id,
955961
type='ROOT',
956962
listall=True
@@ -969,30 +975,28 @@ def test_06_template_tag(self):
969975
self.vm_1.name)
970976
#Create template from volume
971977
template = Template.create(
972-
self.apiclient,
978+
self.user_api_client,
973979
self.services["template"],
974980
self.volume.id
975981
)
976982
self.cleanup.append(template)
977983
self.debug("Created the template(%s). Now restarting the userVm: %s" %
978984
(template.name, self.vm_1.name))
979-
self.vm_1.start(self.apiclient)
985+
self.vm_1.start(self.user_api_client)
980986

981987
self.debug("Creating a tag for the template")
982988
tag = Tag.create(
983-
self.apiclient,
989+
self.user_api_client,
984990
resourceIds=template.id,
985991
resourceType='Template',
986992
tags={'OS': 'CentOS'}
987993
)
988994
self.debug("Tag created: %s" % tag.__dict__)
989995

990996
tags = Tag.list(
991-
self.apiclient,
997+
self.user_api_client,
992998
listall=True,
993999
resourceType='Template',
994-
account=self.account.name,
995-
domainid=self.account.domainid,
9961000
key='OS',
9971001
value='CentOS'
9981002
)
@@ -1008,7 +1012,7 @@ def test_06_template_tag(self):
10081012
)
10091013

10101014
Template.list(
1011-
self.apiclient,
1015+
self.user_api_client,
10121016
templatefilter=\
10131017
self.services["template"]["templatefilter"],
10141018
listall=True,
@@ -1019,7 +1023,7 @@ def test_06_template_tag(self):
10191023
self.debug("Deleting the created tag..")
10201024
try:
10211025
tag.delete(
1022-
self.apiclient,
1026+
self.user_api_client,
10231027
resourceIds=template.id,
10241028
resourceType='Template',
10251029
tags={'OS': 'CentOS'}
@@ -1029,11 +1033,9 @@ def test_06_template_tag(self):
10291033

10301034
self.debug("Verifying if tag is actually deleted!")
10311035
tags = Tag.list(
1032-
self.apiclient,
1036+
self.user_api_client,
10331037
listall=True,
10341038
resourceType='Template',
1035-
account=self.account.name,
1036-
domainid=self.account.domainid,
10371039
key='OS',
10381040
value='CentOS'
10391041
)

0 commit comments

Comments
 (0)