aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_downloader.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_downloader.py')
-rw-r--r--test/test_downloader.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/test_downloader.py b/test/test_downloader.py
index f6c3dbe..fb442c4 100644
--- a/test/test_downloader.py
+++ b/test/test_downloader.py
@@ -298,6 +298,15 @@ class TestHTTPDownloader(TestDownloaderBase):
self.assertTrue(success)
self.assertEqual(pathfmt.temppath, "")
+ def test_http_empty(self):
+ url = f"{self.address}/~NUL"
+ pathfmt = self._prepare_destination(None, extension=None)
+ with self.assertLogs(self.downloader.log, "WARNING") as log_info:
+ success = self.downloader.download(url, pathfmt)
+ self.assertFalse(success)
+ self.assertEqual(log_info.output[0],
+ "WARNING:downloader.http:Empty file")
+
class TestTextDownloader(TestDownloaderBase):
@@ -400,6 +409,7 @@ SAMPLES = {
("blend", b"BLENDER-v303RENDH"),
("obj" , b"# Blender v3.2.0 OBJ File: 'foo.blend'"),
("clip", b"CSFCHUNK\x00\x00\x00\x00"),
+ ("~NUL", b""),
}
@@ -428,8 +438,9 @@ def generate_tests():
return test
for idx, (ext, content) in enumerate(SAMPLES):
- test = generate_test(idx, ext, content)
- setattr(TestHTTPDownloader, test.__name__, test)
+ if ext[0].isalnum():
+ test = generate_test(idx, ext, content)
+ setattr(TestHTTPDownloader, test.__name__, test)
generate_tests()