changeset 264:445f498bc1d4

test_upload_compressed
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Feb 2020 11:07:37 +0100
parents a2719263fd04
children 8d63d035b837
files Database/DummyCT.dcm.gz Tests/Tests.py
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file Database/DummyCT.dcm.gz has changed
--- a/Tests/Tests.py	Thu Feb 20 19:58:30 2020 +0100
+++ b/Tests/Tests.py	Tue Feb 25 11:07:37 2020 +0100
@@ -4899,6 +4899,20 @@
         
         # Switch back to the original log level
         DoPut(_REMOTE, '/tools/log-level', original)
+
+
+    def test_upload_compressed(self):
+        with open(GetDatabasePath('DummyCT.dcm.gz'), 'rb') as f:
+            d = f.read()
+
+        self.assertRaises(Exception, lambda: DoPost(_REMOTE, '/instances', d, 'application/dicom'))
+        
+        self.assertRaises(Exception, lambda: DoPost(_REMOTE, '/instances', d, 'application/dicom',
+                                                    headers = { 'Content-Encoding' : 'nope' }))
+        
+        a = DoPost(_REMOTE, '/instances', d, 'application/dicom',
+                   headers = { 'Content-Encoding' : 'gzip' })
+        self.assertEqual('66a662ce-7430e543-bad44d47-0dc5a943-ec7a538d', a['ID'])
         
         
     def test_study_series_find_inconsistency(self):