comparison Tests/Tests.py @ 490:10a47656e34f

new tests for MaximumStorageMode
author Alain Mazy <am@osimis.io>
date Tue, 09 Aug 2022 17:57:57 +0200
parents e904b2282b0e
children f78f7ee6b660
comparison
equal deleted inserted replaced
489:2078cb20a560 490:10a47656e34f
2475 2475
2476 while retries > 0: 2476 while retries > 0:
2477 retries -= 1 2477 retries -= 1
2478 with open(os.devnull, 'w') as FNULL: 2478 with open(os.devnull, 'w') as FNULL:
2479 try: 2479 try:
2480
2481 print([ FindExecutable('storescu') ] + tmp +
2482 [ _REMOTE['Server'], str(_REMOTE['DicomPort']),
2483 GetDatabasePath(image) ])
2480 subprocess.check_call([ FindExecutable('storescu') ] + tmp + 2484 subprocess.check_call([ FindExecutable('storescu') ] + tmp +
2481 [ _REMOTE['Server'], str(_REMOTE['DicomPort']), 2485 [ _REMOTE['Server'], str(_REMOTE['DicomPort']),
2482 GetDatabasePath(image) ], 2486 GetDatabasePath(image) ],
2483 stderr = FNULL) 2487 stderr = FNULL)
2484 2488
2503 DoPut(_REMOTE, '/tools/unknown-sop-class-accepted', '0') 2507 DoPut(_REMOTE, '/tools/unknown-sop-class-accepted', '0')
2504 self.assertEqual(0, DoGet(_REMOTE, '/tools/unknown-sop-class-accepted')) 2508 self.assertEqual(0, DoGet(_REMOTE, '/tools/unknown-sop-class-accepted'))
2505 else: 2509 else:
2506 InstallLuaScriptFromPath(_REMOTE, 'Lua/TransferSyntaxDisable.lua') 2510 InstallLuaScriptFromPath(_REMOTE, 'Lua/TransferSyntaxDisable.lua')
2507 2511
2508 # the following line regularly fails on CI because storescu still returns 0 although the C-Store fails !! 2512 # the following line regularly fails on CI because storescu still returns 0 although the C-Store fails -> that's why we have implemented retries
2509 self.assertRaises(Exception, lambda: storescu('Knix/Loc/IM-0001-0001.dcm', False, False, 3)) 2513 self.assertRaises(Exception, lambda: storescu('Knix/Loc/IM-0001-0001.dcm', False, False, 3))
2510 self.assertRaises(Exception, lambda: storescu('UnknownSopClassUid.dcm', True, False, 3)) 2514 self.assertRaises(Exception, lambda: storescu('UnknownSopClassUid.dcm', True, False, 3))
2511 self.assertEqual(0, len(DoGet(_REMOTE, '/patients'))) 2515 self.assertEqual(0, len(DoGet(_REMOTE, '/patients')))
2512 2516
2513 if IsOrthancVersionAbove(_REMOTE, 1, 9, 0): 2517 if IsOrthancVersionAbove(_REMOTE, 1, 9, 0):
2520 2524
2521 DoPost(_REMOTE, '/tools/execute-script', "print('All special transfer syntaxes are now accepted')") 2525 DoPost(_REMOTE, '/tools/execute-script', "print('All special transfer syntaxes are now accepted')")
2522 storescu('Knix/Loc/IM-0001-0001.dcm', False) 2526 storescu('Knix/Loc/IM-0001-0001.dcm', False)
2523 storescu('UnknownSopClassUid.dcm', True) 2527 storescu('UnknownSopClassUid.dcm', True)
2524 self.assertEqual(2, len(DoGet(_REMOTE, '/patients'))) 2528 self.assertEqual(2, len(DoGet(_REMOTE, '/patients')))
2529
2530 time.sleep(200)
2525 2531
2526 # set back normal verbosity 2532 # set back normal verbosity
2527 DoPut(_REMOTE, '/tools/log-level', 'default') 2533 DoPut(_REMOTE, '/tools/log-level', 'default')
2528 2534
2529 def test_storescu_jpeg(self): 2535 def test_storescu_jpeg(self):