|
@@ -57,6 +57,7 @@ def _make_download(self, url, destination, cancel=False): |
|
|
|
|
|
loop.exec_() |
|
|
|
|
|
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test with http://www.qgis.org unstable. Needs local server.') |
|
|
def test_validDownload(self): |
|
|
"""Tests a valid download""" |
|
|
destination = tempfile.mktemp() |
|
@@ -81,6 +82,7 @@ def test_inValidDownload(self): |
|
|
self.assertEqual(self.error_args[1], [u'Download failed: Host www.doesnotexistofthatimsure.qgis not found']) |
|
|
self.assertFalse(os.path.isfile(destination)) |
|
|
|
|
|
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test with http://www.github.com unstable. Needs local server.') |
|
|
def test_dowloadCanceled(self): |
|
|
"""Tests user canceled download""" |
|
|
destination = tempfile.mktemp() |
|
@@ -101,6 +103,7 @@ def test_InvalidUrl(self): |
|
|
self.assertFalse(os.path.isfile(destination)) |
|
|
self.assertEqual(self.error_args[1], [u"Download failed: Protocol \"xyz\" is unknown"]) |
|
|
|
|
|
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test with http://www.github.com unstable. Needs local server.') |
|
|
def test_InvalidFile(self): |
|
|
self._make_download('https://github.com/qgis/QGIS/archive/master.zip', "") |
|
|
self.assertTrue(self.exited_was_called) |
|
@@ -132,6 +135,7 @@ def ssl_compare(self, name, url, error): |
|
|
result = ';'.join(result) |
|
|
self.assertTrue(result.startswith(error), msg + "expected:\n%s\nactual:\n%s\n" % (result, error)) |
|
|
|
|
|
@unittest.skipIf(os.environ.get('TRAVIS', '') == 'true', 'Test with badssl.com unstable. Needs local server.') |
|
|
def test_sslExpired(self): |
|
|
self.ssl_compare("expired", "https://expired.badssl.com/", "SSL Errors: ;The certificate has expired") |
|
|
self.ssl_compare("self-signed", "https://self-signed.badssl.com/", "SSL Errors: ;The certificate is self-signed, and untrusted") |
|
|