@@ -126,7 +126,7 @@ def setupAccount(self, accountType):
126126 except Exception as e :
127127 return [FAIL , e ]
128128 return [PASS , None ]
129-
129+
130130 @data (ROOT_DOMAIN_ADMIN , CHILD_DOMAIN_ADMIN )
131131 @attr (tags = ["advanced" ], required_hardware = "true" )
132132 def test_01_register_template (self , value ):
@@ -143,24 +143,28 @@ def test_01_register_template(self, value):
143143 response = self .setupAccount (value )
144144 self .assertEqual (response [0 ], PASS , response [1 ])
145145
146+ apiclient = self .testClient .getUserApiClient (
147+ UserName = self .account .name ,
148+ DomainName = self .account .domain )
149+
146150 builtin_info = get_builtin_template_info (self .apiclient , self .zone .id )
147151 self .services ["template_2" ]["url" ] = builtin_info [0 ]
148152 self .services ["template_2" ]["hypervisor" ] = builtin_info [1 ]
149153 self .services ["template_2" ]["format" ] = builtin_info [2 ]
150154
151155 try :
152- template = Template .register (self . apiclient ,
156+ template = Template .register (apiclient ,
153157 self .services ["template_2" ],
154158 zoneid = self .zone .id ,
155159 account = self .account .name ,
156160 domainid = self .account .domainid ,
157161 hypervisor = self .hypervisor )
158162
159- template .download (self . apiclient )
163+ template .download (apiclient )
160164 except Exception as e :
161165 self .fail ("Failed to register template: %s" % e )
162166
163- templates = Template .list (self . apiclient ,
167+ templates = Template .list (apiclient ,
164168 templatefilter = \
165169 self .services ["template_2" ]["templatefilter" ],
166170 id = template .id )
@@ -170,19 +174,19 @@ def test_01_register_template(self, value):
170174 templateSize = (templates [0 ].size / (1024 ** 3 ))
171175 expectedCount = templateSize
172176 response = matchResourceCount (
173- self . apiclient , expectedCount ,
177+ apiclient , expectedCount ,
174178 RESOURCE_SECONDARY_STORAGE ,
175179 accountid = self .account .id )
176180 self .assertEqual (response [0 ], PASS , response [1 ])
177181
178182 try :
179- template .delete (self . apiclient )
183+ template .delete (apiclient )
180184 except Exception as e :
181185 self .fail ("Failed to delete template: %s" % e )
182186
183187 expectedCount = 0
184188 response = matchResourceCount (
185- self . apiclient , expectedCount ,
189+ apiclient , expectedCount ,
186190 RESOURCE_SECONDARY_STORAGE ,
187191 accountid = self .account .id )
188192 self .assertEqual (response [0 ], PASS , response [1 ])
0 commit comments