Mercurial > hg > orthanc-tests
changeset 187:770f6f5aea16
test_async_archive
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Dec 2018 12:42:38 +0100 |
parents | 8feebc2bf9fc |
children | 7d585263808b |
files | GenerateConfigurationForTests.py Tests/Tests.py |
diffstat | 2 files changed, 53 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/GenerateConfigurationForTests.py Thu Nov 29 20:36:08 2018 +0100 +++ b/GenerateConfigurationForTests.py Thu Dec 06 12:42:38 2018 +0100 @@ -114,6 +114,7 @@ config['OverwriteInstances'] = True config['JobsHistorySize'] = 1000 config['SynchronousCMove'] = False +config['MediaArchiveSize'] = 1 config['Dictionary'] = { '00e1,10c2' : [ 'UI', 'PET-CT Multi Modality Name', 1, 1, 'ELSCINT1' ],
--- a/Tests/Tests.py Thu Nov 29 20:36:08 2018 +0100 +++ b/Tests/Tests.py Thu Dec 06 12:42:38 2018 +0100 @@ -3964,3 +3964,55 @@ if (key in b): self.assertNotEqual(a[key], b[key]) + + def test_async_archive(self): + # Testing the asynchronous generation of archives/medias (new + # in Orthanc 1.4.3) + UploadInstance(_REMOTE, 'Knee/T1/IM-0001-0001.dcm') + UploadInstance(_REMOTE, 'Knee/T2/IM-0001-0001.dcm') + + kneeT1 = '6de73705-c4e65c1b-9d9ea1b5-cabcd8e7-f15e4285' + kneeT2 = 'bbf7a453-0d34251a-03663b55-46bb31b9-ffd74c59' + + job = MonitorJob2(_REMOTE, lambda: DoPost + (_REMOTE, '/studies/%s/archive' % kneeT1, { + 'Synchronous' : False + })) + + z = GetArchive(_REMOTE, '/jobs/%s/archive' % job) + self.assertEqual(1, len(z.namelist())) + self.assertFalse('DICOMDIR' in z.namelist()) + + job2 = MonitorJob2(_REMOTE, lambda: DoPost + (_REMOTE, '/studies/%s/media' % kneeT1, { + 'Synchronous' : False + })) + + # The archive from the first job has been replaced by the + # archive from second job (as MediaArchiveSize == 1) + self.assertRaises(Exception, lambda: GetArchive(_REMOTE, '/jobs/%s/archive' % job)) + + z = GetArchive(_REMOTE, '/jobs/%s/archive' % job2) + self.assertEqual(2, len(z.namelist())) + self.assertTrue('DICOMDIR' in z.namelist()) + + job = MonitorJob2(_REMOTE, lambda: DoPost + (_REMOTE, '/tools/create-archive', { + 'Synchronous' : False, + 'Resources' : [ kneeT1, kneeT2 ], + })) + + z = GetArchive(_REMOTE, '/jobs/%s/archive' % job) + self.assertEqual(2, len(z.namelist())) + self.assertFalse('DICOMDIR' in z.namelist()) + + job = MonitorJob2(_REMOTE, lambda: DoPost + (_REMOTE, '/tools/create-media', { + 'Synchronous' : False, + 'Resources' : [ kneeT1, kneeT2 ], + })) + + z = GetArchive(_REMOTE, '/jobs/%s/archive' % job) + self.assertEqual(3, len(z.namelist())) + self.assertTrue('DICOMDIR' in z.namelist()) +