Browser Basesd Test Template changes

This commit is contained in:
sailajamada 2015-03-23 09:58:02 +05:30
parent aad9b8a51f
commit f22bd7a79e

View File

@ -147,19 +147,22 @@ class TestBrowseUploadVolume(cloudstackTestCase):
list_template_response = Template.list( list_template_response = Template.list(
self.apiclient, self.apiclient,
id=up_templateid id=up_templateid,
) templatefilter="all",
zoneid=self.zone.id)
self.assertNotEqual( self.assertNotEqual(
list_volume_response, list_template_response,
None, None,
"Check if template exists in ListTemplates" "Check if template exists in ListTemplates"
) )
self.assertEqual( self.assertEqual(
list_template_response[0].state, list_template_response[0].status,
templatestate, templatestate,
"Check template state in List templates" "Check template status in List templates"
) )
return
def browse_upload_template(self): def browse_upload_template(self):
cmd = getUploadParamsForTemplate.getUploadParamsForTemplateCmd() cmd = getUploadParamsForTemplate.getUploadParamsForTemplateCmd()
@ -171,6 +174,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
cmd.displaytext=self.templatename+self.account.name+(random.choice(string.ascii_uppercase)) cmd.displaytext=self.templatename+self.account.name+(random.choice(string.ascii_uppercase))
cmd.hypervisor=self.templatehypervisor cmd.hypervisor=self.templatehypervisor
cmd.ostypeid=self.templateostypeid cmd.ostypeid=self.templateostypeid
cmd.isdynamicallyscalable="false"
#cmd.type="template" #cmd.type="template"
getuploadparamsresponce=self.apiclient.getUploadParamsForTemplate(cmd) getuploadparamsresponce=self.apiclient.getUploadParamsForTemplate(cmd)
@ -200,13 +204,13 @@ class TestBrowseUploadVolume(cloudstackTestCase):
headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata} headers={'X-signature':signt,'X-metadata':metadata,'X-expires':expiredata}
results = requests.post(posturl,files=files,headers=headers,verify=False) results = requests.post(posturl,files=files,headers=headers,verify=False)
time.sleep(60) time.sleep(600)
print results.status_code print results.status_code
if results.status_code !=200: if results.status_code !=200:
self.fail("Upload is not fine") self.fail("Upload is not fine")
self.validate_uploaded_template(getuploadparamsresponce.id,'Uploaded') self.validate_uploaded_template(getuploadparamsresponce.id,'Download Complete')
return(getuploadparamsresponce) return(getuploadparamsresponce)
@ -262,9 +266,13 @@ class TestBrowseUploadVolume(cloudstackTestCase):
templ1=self.uploadtemplate() templ1=self.uploadtemplate()
templ2=self.uploadtemplate() templ2=self.uploadtemplate()
templ3=self.uploadtemplate() templ3=self.uploadtemplate()
self.validate_uploaded_template(templ1.id,'Uploaded') time.sleep(600)
self.validate_uploaded_template(templ2.id,'Uploaded') self.validate_uploaded_template(templ1.id,'Download Complete')
self.validate_uploaded_template(templ3.id,'Uploaded') self.validate_uploaded_template(templ2.id,'Download Complete')
self.validate_uploaded_template(templ3.id,'Download Complete')
self.delete_template(templ1)
self.delete_template(templ2)
self.delete_template(templ3)
return return
def validate_vm(self,vmdetails,vmstate): def validate_vm(self,vmdetails,vmstate):
@ -1113,12 +1121,13 @@ class TestBrowseUploadVolume(cloudstackTestCase):
def delete_template(self,templatedetails): def delete_template(self,templatedetails):
print templatedetails
list_template_response = Template.list( list_template_response = Template.list(
self.apiclient, self.apiclient,
templatefilter=\ templatefilter="all",
self.testdata["template"]["templatefilter"],
id=templatedetails.id, id=templatedetails.id,
zoneid=self.zone.id) zoneid=self.zone.id)
print list_template_response
self.assertEqual( self.assertEqual(
isinstance(list_template_response, list), isinstance(list_template_response, list),
True, True,
@ -1139,15 +1148,13 @@ class TestBrowseUploadVolume(cloudstackTestCase):
(template_response.id, templatedetails.id) (template_response.id, templatedetails.id)
) )
self.debug("Deleting template: %s" % self.template) # Delete the template
# Delete the template
templatedetails.delete(self.apiclient) templatedetails.delete(self.apiclient)
self.debug("Delete template: %s successful" % templatedetails) self.debug("Delete template: %s successful" % templatedetails)
list_template_response = Template.list( list_template_response = Template.list(
self.apiclient, self.apiclient,
templatefilter=\ templatefilter="all",
self.services["template"]["templatefilter"],
id=templatedetails.id, id=templatedetails.id,
zoneid=self.zone.id zoneid=self.zone.id
) )
@ -1254,8 +1261,8 @@ class TestBrowseUploadVolume(cloudstackTestCase):
self.expunge_vm(vm2details) self.expunge_vm(vm2details)
self.debug("========================= Test 9: Delete the Uploaded Template========================= ") self.debug("========================= Test 9: Delete the Uploaded Template========================= ")
print browseup_template
self.delete_template(browseup_template) #self.delete_template(browseup_template)
self.debug("========================= Test 10: Upload Multiple templates========================= ") self.debug("========================= Test 10: Upload Multiple templates========================= ")
@ -1267,7 +1274,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
@attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true") @attr(tags = ["advanced", "advancedns", "smoke", "basic"], required_hardware="true")
def test_02_SSVM_Life_Cycle_With_Browser_Template_TPath(self): def xtest_02_SSVM_Life_Cycle_With_Browser_Template_TPath(self):
""" """
Test SSVM_Life_Cycle_With_Browser_template_TPath Test SSVM_Life_Cycle_With_Browser_template_TPath
""" """
@ -1314,6 +1321,7 @@ class TestBrowseUploadVolume(cloudstackTestCase):
return return
@classmethod @classmethod
def tearDownClass(self): def tearDownClass(self):
try: try: