# HG changeset patch # User Sebastien Jodogne # Date 1588957506 -7200 # Node ID e1827a4f5d3bfb6371e8e7f486c82fd3090343ee # Parent cfa785074c640513c5821d2cb598d287ba57e648 test_archive_transcode diff -r cfa785074c64 -r e1827a4f5d3b Tests/Tests.py --- 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]))) +