Mercurial > hg > orthanc-tests
changeset 508:ae493446336a
fix tests for missing archives
author | Alain Mazy <am@osimis.io> |
---|---|
date | Fri, 03 Mar 2023 10:57:09 +0100 |
parents | 1596865844ff |
children | 17a74118d73a |
files | Tests/Tests.py |
diffstat | 1 files changed, 7 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/Tests/Tests.py Fri Feb 24 17:28:54 2023 +0100 +++ b/Tests/Tests.py Fri Mar 03 10:57:09 2023 +0100 @@ -179,6 +179,8 @@ import warnings warnings.simplefilter("ignore", ResourceWarning) + print('running : %s' % self.id()) + DropOrthanc(_LOCAL) DropOrthanc(_REMOTE) UninstallLuaCallbacks(_REMOTE) @@ -4658,7 +4660,7 @@ kneeT2 = 'bbf7a453-0d34251a-03663b55-46bb31b9-ffd74c59' job = MonitorJob2(_REMOTE, lambda: DoPost - (_REMOTE, '/studies/%s/archive' % kneeT1, { + (_REMOTE, '/series/%s/archive' % kneeT1, { 'Synchronous' : False })) @@ -4672,7 +4674,7 @@ self.assertEqual(0, info['Content']['UncompressedSizeMB']) job2 = MonitorJob2(_REMOTE, lambda: DoPost - (_REMOTE, '/studies/%s/media' % kneeT1, { + (_REMOTE, '/series/%s/media' % kneeT1, { 'Synchronous' : False })) @@ -4954,8 +4956,9 @@ def test_bitbucket_issue_124(self): a = UploadInstance(_REMOTE, 'Issue124.dcm')['ID'] - - z = GetArchive(_REMOTE, '/patients/%s/media' % a) + s = DoGet(_REMOTE, '/instances/%s/series' % a)['ID'] + + z = GetArchive(_REMOTE, '/series/%s/media' % s) self.assertEqual(2, len(z.namelist())) @@ -9221,53 +9224,3 @@ self.assertEqual(1475, im.size[0]) self.assertEqual(1475, im.size[1]) self.assertEqual('c684b0050dc2523041240bf2d26dc85e', ComputeMD5(DoGet(_REMOTE, uri))) - - - def test_nonexistent_archives(self): - def GetNumberOfFiles(uri): - archive = DoGet(_REMOTE, uri) - z = zipfile.ZipFile(StringIO(archive), 'r') - return len(z.namelist()) - - def IsExistent(uri): - try: - DoGet(_REMOTE, uri) - return True - except: - return False - - instance = UploadInstance(_REMOTE, 'DummyCT.dcm') ['ID'] - patient = DoGet(_REMOTE, '/instances/%s/patient' % instance) ['ID'] - study = DoGet(_REMOTE, '/instances/%s/study' % instance) ['ID'] - series = DoGet(_REMOTE, '/instances/%s/series' % instance) ['ID'] - - self.assertEqual(1, GetNumberOfFiles('/patients/%s/archive' % patient)) - self.assertEqual(2, GetNumberOfFiles('/patients/%s/media' % patient)) - self.assertEqual(1, GetNumberOfFiles('/studies/%s/archive' % study)) - self.assertEqual(2, GetNumberOfFiles('/studies/%s/media' % study)) - self.assertEqual(1, GetNumberOfFiles('/series/%s/archive' % series)) - self.assertEqual(2, GetNumberOfFiles('/series/%s/media' % series)) - - self.assertTrue(IsExistent('/patients/%s/archive' % patient)) - self.assertFalse(IsExistent('/studies/%s/archive' % patient)) - self.assertFalse(IsExistent('/series/%s/archive' % patient)) - - self.assertFalse(IsExistent('/patients/%s/archive' % study)) - self.assertTrue(IsExistent('/studies/%s/archive' % study)) - self.assertFalse(IsExistent('/series/%s/archive' % study)) - - self.assertFalse(IsExistent('/patients/%s/archive' % series)) - self.assertFalse(IsExistent('/studies/%s/archive' % series)) - self.assertTrue(IsExistent('/series/%s/archive' % series)) - - self.assertTrue(IsExistent('/patients/%s/media' % patient)) - self.assertFalse(IsExistent('/studies/%s/media' % patient)) - self.assertFalse(IsExistent('/series/%s/media' % patient)) - - self.assertFalse(IsExistent('/patients/%s/media' % study)) - self.assertTrue(IsExistent('/studies/%s/media' % study)) - self.assertFalse(IsExistent('/series/%s/media' % study)) - - self.assertFalse(IsExistent('/patients/%s/media' % series)) - self.assertFalse(IsExistent('/studies/%s/media' % series)) - self.assertTrue(IsExistent('/series/%s/media' % series))