# HG changeset patch # User Sebastien Jodogne # Date 1582625257 -3600 # Node ID 445f498bc1d45d5c09e497c7fb0f0ae2f95d83cc # Parent a2719263fd043adb33137ee051f4ebfbf27b869e test_upload_compressed diff -r a2719263fd04 -r 445f498bc1d4 Database/DummyCT.dcm.gz Binary file Database/DummyCT.dcm.gz has changed diff -r a2719263fd04 -r 445f498bc1d4 Tests/Tests.py --- 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):