def test_download(self): """Test download.""" manager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # ...or not...changed on 5 Dec 2013 by Tim to hash below... unique_hash = 'd4b691cd9d99117b2ea34586d3e7eeb8' url = 'http://google.com' path = tempfile.mktemp() file_downloader = FileDownloader( manager, url, path) try: result = file_downloader.download() except IOError as ex: raise IOError(ex) if result[0] is not True: _, error_message = result raise DownloadError(error_message) assert_hash_for_file(unique_hash, path)
def test_download(self): """Test download.""" manager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # ...or not...changed on 5 Dec 2013 ... # ...and changed on 28 Apr 2014 by Tim to hash and url below unique_hash = '32230a09ffe7b0011095e8cd627097a5' url = 'http://inasafe.org/en/_static/img/logo.png' path = tempfile.mktemp() file_downloader = FileDownloader( manager, url, path) try: result = file_downloader.download() except IOError as ex: raise IOError(ex) if result[0] is not True: _, error_message = result raise DownloadError(error_message) assert_hash_for_file(unique_hash, path)
def test_download(self): """Test download.""" manager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # ...or not...changed on 5 Dec 2013 ... # ...and changed on 28 Apr 2014 by Tim to hash and url below unique_hash = '32230a09ffe7b0011095e8cd627097a5' url = 'http://inasafe.org/en/_static/img/logo.png' path = tempfile.mktemp() file_downloader = FileDownloader( manager, url, path) try: result = file_downloader.download() except IOError as ex: raise IOError(ex) if result[0] is not True: _, error_message = result raise DownloadError(error_message) assert_hash_for_file(unique_hash, path)
def test_download_url(self): """Test we can download a zip. Uses a mock network stack.""" myManager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # myHash = 'd4b691cd9d99117b2ea34586d3e7eeb8' myUrl = 'http://google.com' myTempFilePath = tempfile.mktemp() download_url(myManager, myUrl, myTempFilePath) assert_hash_for_file(myHash, myTempFilePath)
def test_download_url(self): """Test we can download a zip. Uses a mock network stack.""" myManager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # myHash = 'd4b691cd9d99117b2ea34586d3e7eeb8' myUrl = 'http://google.com' myTempFilePath = tempfile.mktemp() download_url(myManager, myUrl, myTempFilePath) assert_hash_for_file(myHash, myTempFilePath)
def test_download_url(self): """Test we can download a zip. Uses a mock network stack.""" manager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # ...or not...changed on 5 Dec 2013 by Tim to hash below... unique_hash = 'd4b691cd9d99117b2ea34586d3e7eeb8' url = 'http://google.com' path = tempfile.mktemp() download_url(manager, url, path) assert_hash_for_file(unique_hash, path)
def test_download_url(self): """Test we can download a zip. Uses a mock network stack.""" manager = QNetworkAccessManager(PARENT) # NOTE(gigih): # this is the hash of google front page. # I think we can safely assume that the content # of google.com never changes (probably). # ...or not...changed on 5 Dec 2013 by Tim to hash below... unique_hash = 'd4b691cd9d99117b2ea34586d3e7eeb8' url = 'http://google.com' path = tempfile.mktemp() download_url(manager, url, path) assert_hash_for_file(unique_hash, path)