diff Tests/Tests.py @ 292:e1827a4f5d3b

test_archive_transcode
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 08 May 2020 19:05:06 +0200
parents cfa785074c64
children 032722c3e919
line wrap: on
line diff
--- a/Tests/Tests.py	Thu May 07 15:33:40 2020 +0200
+++ b/Tests/Tests.py	Fri May 08 19:05:06 2020 +0200
@@ -5530,4 +5530,40 @@
                 })
             
             self.assertEqual(syntax, GetTransferSyntax(transcoded))
-                   
+
+
+    def test_archive_transcode(self):
+        info = UploadInstance(_REMOTE, 'KarstenHilbertRF.dcm')
+
+        # "/media"
+        z = GetArchive(_REMOTE, '/patients/%s/media' % info['ParentPatient'])
+        self.assertEqual(2, len(z.namelist()))
+        self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(z.read('IMAGES/IM0')))
+
+        self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/patients/%s/media?transcode=nope' % info['ParentPatient']))
+
+        z = GetArchive(_REMOTE, '/patients/%s/media?transcode=1.2.840.10008.1.2.4.50' % info['ParentPatient'])
+        self.assertEqual('1.2.840.10008.1.2.4.50', GetTransferSyntax(z.read('IMAGES/IM0')))
+
+        z = GetArchive(_REMOTE, '/studies/%s/media?transcode=1.2.840.10008.1.2.4.51' % info['ParentStudy'])
+        self.assertEqual('1.2.840.10008.1.2.4.51', GetTransferSyntax(z.read('IMAGES/IM0')))
+
+        z = GetArchive(_REMOTE, '/series/%s/media?transcode=1.2.840.10008.1.2.4.57' % info['ParentSeries'])
+        self.assertEqual('1.2.840.10008.1.2.4.57', GetTransferSyntax(z.read('IMAGES/IM0')))
+
+        # "/archive"
+        z = GetArchive(_REMOTE, '/patients/%s/archive' % info['ParentPatient'])
+        self.assertEqual(1, len(z.namelist()))
+        self.assertEqual('1.2.840.10008.1.2.1', GetTransferSyntax(z.read(z.namelist()[0])))
+
+        self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/patients/%s/archive?transcode=nope' % info['ParentPatient']))
+
+        z = GetArchive(_REMOTE, '/patients/%s/archive?transcode=1.2.840.10008.1.2' % info['ParentPatient'])
+        self.assertEqual('1.2.840.10008.1.2', GetTransferSyntax(z.read(z.namelist()[0])))
+
+        z = GetArchive(_REMOTE, '/studies/%s/archive?transcode=1.2.840.10008.1.2.2' % info['ParentStudy'])
+        self.assertEqual('1.2.840.10008.1.2.2', GetTransferSyntax(z.read(z.namelist()[0])))
+
+        z = GetArchive(_REMOTE, '/series/%s/archive?transcode=1.2.840.10008.1.2.4.70' % info['ParentSeries'])
+        self.assertEqual('1.2.840.10008.1.2.4.70', GetTransferSyntax(z.read(z.namelist()[0])))
+