@@ -174,67 +174,69 @@ def test_01_create_template(self):
174174 # tar bzip template.
175175 # 6. Verify VMs & Templates is up and in ready state
176176
177- for k , v in self .services ["templates" ].items ():
177+ builtin_info = get_builtin_template_info (self .apiclient , self .zone .id )
178+ self .services ["templates" ][0 ]["url" ] = builtin_info [0 ]
179+ self .services ["templates" ][0 ]["hypervisor" ] = builtin_info [1 ]
180+ self .services ["templates" ][0 ]["format" ] = builtin_info [2 ]
178181
179- # Register new template
180- template = Template .register (
182+ # Register new template
183+ template = Template .register (
181184 self .apiclient ,
182- v ,
185+ self . services [ "templates" ][ 0 ] ,
183186 zoneid = self .zone .id ,
184187 account = self .account .name ,
185188 domainid = self .account .domainid
186189 )
187- self .debug (
190+ self .debug (
188191 "Registered a template of format: %s with ID: %s" % (
189- v ["format" ],
192+ self . services [ "templates" ][ 0 ] ["format" ],
190193 template .id
191194 ))
192- # Wait for template to download
193- template .download (self .apiclient )
194- self .cleanup .append (template )
195-
196- # Wait for template status to be changed across
197- time .sleep (self .services ["sleep" ])
198- timeout = self .services ["timeout" ]
199- while True :
200- list_template_response = list_templates (
195+ # Wait for template to download
196+ template .download (self .apiclient )
197+ self .cleanup .append (template )
198+
199+ # Wait for template status to be changed across
200+ time .sleep (self .services ["sleep" ])
201+ timeout = self .services ["timeout" ]
202+ while True :
203+ list_template_response = list_templates (
201204 self .apiclient ,
202- templatefilter = \
203- self .services ["templatefilter" ],
205+ templatefilter = 'all' ,
204206 id = template .id ,
205207 zoneid = self .zone .id ,
206208 account = self .account .name ,
207209 domainid = self .account .domainid
208210 )
209- if isinstance (list_template_response , list ):
210- break
211- elif timeout == 0 :
212- raise Exception ("List template failed!" )
213-
214- time .sleep (5 )
215- timeout = timeout - 1
216- #Verify template response to check whether template added successfully
217- self .assertEqual (
211+ if isinstance (list_template_response , list ):
212+ break
213+ elif timeout == 0 :
214+ raise Exception ("List template failed!" )
215+
216+ time .sleep (5 )
217+ timeout = timeout - 1
218+ #Verify template response to check whether template added successfully
219+ self .assertEqual (
218220 isinstance (list_template_response , list ),
219221 True ,
220222 "Check for list template response return valid data"
221223 )
222224
223- self .assertNotEqual (
225+ self .assertNotEqual (
224226 len (list_template_response ),
225227 0 ,
226228 "Check template available in List Templates"
227229 )
228230
229- template_response = list_template_response [0 ]
230- self .assertEqual (
231+ template_response = list_template_response [0 ]
232+ self .assertEqual (
231233 template_response .isready ,
232234 True ,
233235 "Check display text of newly created template"
234236 )
235237
236- # Deploy new virtual machine using template
237- virtual_machine = VirtualMachine .create (
238+ # Deploy new virtual machine using template
239+ virtual_machine = VirtualMachine .create (
238240 self .apiclient ,
239241 self .services ["virtual_machine" ],
240242 templateid = template .id ,
@@ -243,26 +245,26 @@ def test_01_create_template(self):
243245 serviceofferingid = self .service_offering .id ,
244246 mode = self .services ["mode" ]
245247 )
246- self .debug ("creating an instance with template ID: %s" % template .id )
247- vm_response = list_virtual_machines (
248+ self .debug ("creating an instance with template ID: %s" % template .id )
249+ vm_response = list_virtual_machines (
248250 self .apiclient ,
249251 id = virtual_machine .id ,
250252 account = self .account .name ,
251253 domainid = self .account .domainid
252254 )
253- self .assertEqual (
255+ self .assertEqual (
254256 isinstance (vm_response , list ),
255257 True ,
256258 "Check for list VMs response after VM deployment"
257259 )
258260 #Verify VM response to check whether VM deployment was successful
259- self .assertNotEqual (
261+ self .assertNotEqual (
260262 len (vm_response ),
261263 0 ,
262264 "Check VMs available in List VMs response"
263265 )
264- vm = vm_response [0 ]
265- self .assertEqual (
266+ vm = vm_response [0 ]
267+ self .assertEqual (
266268 vm .state ,
267269 'Running' ,
268270 "Check the state of VM created from Template"
0 commit comments