Mercurial > hg > orthanc-tests
comparison Plugins/DicomWeb/Run.py @ 702:9af8e3ee07d9 attach-custom-data tip
fix
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Fri, 27 Sep 2024 15:07:23 +0200 |
parents | 7282c2df963d |
children |
comparison
equal
deleted
inserted
replaced
699:e3d41c4168c3 | 702:9af8e3ee07d9 |
---|---|
453 self.assertEqual('SH', a[0]['00080050']['vr']) | 453 self.assertEqual('SH', a[0]['00080050']['vr']) |
454 | 454 |
455 | 455 |
456 # this test fails if SeriesMetadata = "MainDicomTags" (this is expected since the reference json is the full json) | 456 # this test fails if SeriesMetadata = "MainDicomTags" (this is expected since the reference json is the full json) |
457 def test_wado_hierarchy(self): | 457 def test_wado_hierarchy(self): |
458 def CheckJson(uri, headers = {}): | 458 if IsOrthancVersionAbove(ORTHANC, 1, 12, 5) and DoGet(ORTHANC, '/system')['ApiVersion'] >= 26: # reference file has been updated |
459 with open(GetDatabasePath('DummyCT.json'), 'r') as f: | 459 def CheckJson(uri, headers = {}): |
460 expected = json.loads(f.read()) | 460 with open(GetDatabasePath('DummyCT.json'), 'r') as f: |
461 actual = DoGet(ORTHANC, uri, headers) | 461 expected = json.loads(f.read()) |
462 self.assertEqual(1, len(actual)) | 462 actual = DoGet(ORTHANC, uri, headers) |
463 AssertAlmostEqualRecursive(self, expected, actual[0]) | 463 self.assertEqual(1, len(actual)) |
464 | 464 AssertAlmostEqualRecursive(self, expected, actual[0]) |
465 UploadInstance(ORTHANC, 'DummyCT.dcm') | 465 |
466 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390' | 466 UploadInstance(ORTHANC, 'DummyCT.dcm') |
467 series = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.394' | 467 study = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.390' |
468 instance = '1.2.840.113619.2.176.2025.1499492.7040.1171286242.109' | 468 series = '1.2.840.113619.2.176.2025.1499492.7391.1171285944.394' |
469 | 469 instance = '1.2.840.113619.2.176.2025.1499492.7040.1171286242.109' |
470 URI = '/dicom-web/studies/%s/series/%s/instances/%s/metadata' | 470 |
471 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, series, instance), | 471 URI = '/dicom-web/studies/%s/series/%s/instances/%s/metadata' |
472 headers = { 'accept' : 'application/nope' })) | 472 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, series, instance), |
473 | 473 headers = { 'accept' : 'application/nope' })) |
474 CheckJson(URI % (study, series, instance), headers = { 'accept' : 'application/dicom+json' }) | 474 |
475 CheckJson('/dicom-web/studies/%s/series/%s/metadata' % (study, series)) | 475 CheckJson(URI % (study, series, instance), headers = { 'accept' : 'application/dicom+json' }) |
476 CheckJson('/dicom-web/studies/%s/metadata' % study) | 476 CheckJson('/dicom-web/studies/%s/series/%s/metadata' % (study, series)) |
477 | 477 CheckJson('/dicom-web/studies/%s/metadata' % study) |
478 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % ('nope', series, instance))) | 478 |
479 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, 'nope', instance))) | 479 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % ('nope', series, instance))) |
480 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, series, 'nope'))) | 480 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, 'nope', instance))) |
481 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/metadata' % ('nope', series))) | 481 self.assertRaises(Exception, lambda: DoGet(ORTHANC, URI % (study, series, 'nope'))) |
482 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/metadata' % (study, 'nope'))) | 482 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/metadata' % ('nope', series))) |
483 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % 'nope')) | 483 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/series/%s/metadata' % (study, 'nope'))) |
484 self.assertRaises(Exception, lambda: DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % 'nope')) | |
484 | 485 |
485 | 486 |
486 def test_wado_pixel_data(self): | 487 def test_wado_pixel_data(self): |
487 orthanc = UploadInstance(ORTHANC, 'Issue29.dcm') ['ID'] | 488 orthanc = UploadInstance(ORTHANC, 'Issue29.dcm') ['ID'] |
488 a = DoGet(ORTHANC, '/dicom-web/instances') | 489 a = DoGet(ORTHANC, '/dicom-web/instances') |