def test_04_extract_Iso(self): "Test for extract ISO" # Validate the following # 1. Admin should able extract and download the ISO # 2. ListIsos should display all the public templates # for all kind of users # 3 .ListIsos should not display the system templates self.debug("Extracting ISO with ID: %s" % self.iso_2.id) cmd = extractIso.extractIsoCmd() cmd.id = self.iso_2.id cmd.mode = self.services["iso2"]["mode"] cmd.zoneid = self.services["iso2"]["zoneid"] list_extract_response = self.apiclient.extractIso(cmd) try: # Format URL to ASCII to retrieve response code formatted_url = urllib.unquote_plus(list_extract_response.url) url_response = urllib.urlopen(formatted_url) response_code = url_response.getcode() except Exception: self.fail( "Extract ISO Failed with invalid URL %s (ISO id: %s)" % (formatted_url, self.iso_2.id) ) self.assertEqual( list_extract_response.id, self.iso_2.id, "Check ID of the downloaded ISO" ) self.assertEqual( list_extract_response.extractMode, self.services["iso2"]["mode"], "Check mode of extraction" ) self.assertEqual( list_extract_response.zoneid, self.services["iso2"]["zoneid"], "Check zone ID of extraction" ) self.assertEqual( response_code, 200, "Check for a valid response of download URL" ) return