示例#1
0
 def _verifyHttpURL(self, url):
     tempFilePath = os.path.join(getApplicationModel().getUserProfile().getTempDirectory(), u"tmp_url_mstore_ztest.bin") #$NON-NLS-1$
     downloader = ZHttpBinaryFileDownload(url, tempFilePath)
     try:
         downloader.send()
         ct = downloader.getContentType()
         numBytes = downloader.getResponse()
         if (ct == u"image/png") and (numBytes == 222): #$NON-NLS-1$
             raise ZException(_extstr(u"mediastorageztest.FileStillExistsError") % url) #$NON-NLS-1$
     finally:
         if os.path.isfile(tempFilePath):
             os.remove(tempFilePath)
示例#2
0
 def _verifyHttpURL(self, url):
     tempFilePath = os.path.join(getApplicationModel().getUserProfile().getTempDirectory(), u"tmp_url_mstore_ztest.bin") #$NON-NLS-1$
     downloader = ZHttpBinaryFileDownload(url, tempFilePath)
     try:
         if not downloader.send():
             raise ZException(_extstr(u"mediastorageztest.FileNotFoundError") % url) #$NON-NLS-1$
         ct = downloader.getContentType()
         if not (ct == u"image/png"): #$NON-NLS-1$
             raise ZException(_extstr(u"mediastorageztest.IncorrectContentTypeError") % (ct, url)) #$NON-NLS-1$
         numBytes = downloader.getResponse()
         if numBytes != 222: # Note: the test file is 222 bytes in size
             raise ZException(_extstr(u"mediastorageztest.TestFileWrongSizeError")) #$NON-NLS-1$
     finally:
         if os.path.isfile(tempFilePath):
             os.remove(tempFilePath)