Mercurial > hg > orthanc-tests
comparison Plugins/DicomWeb/Run.py @ 226:230aede7f8d5
test_bitbucket_issue_96
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 26 Feb 2019 20:32:31 +0100 |
parents | 4d5af1f49cb2 |
children | 875ff7460ae8 |
comparison
equal
deleted
inserted
replaced
225:4d5af1f49cb2 | 226:230aede7f8d5 |
---|---|
432 # This is the WADO-RS testing | 432 # This is the WADO-RS testing |
433 a = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study) | 433 a = DoGet(ORTHANC, '/dicom-web/studies/%s/metadata' % study) |
434 self.assertEqual(1, len(a)) | 434 self.assertEqual(1, len(a)) |
435 self.assertEqual('IS', a[0]['00180091']['vr']) # EchoTrainLength | 435 self.assertEqual('IS', a[0]['00180091']['vr']) # EchoTrainLength |
436 | 436 |
437 if (sys.version_info >= (3, 0)): | |
438 types = (int) | |
439 else: | |
440 types = (int, long) | |
441 | |
437 b = a[0]['00180091']['Value'][0] | 442 b = a[0]['00180091']['Value'][0] |
438 self.assertTrue(isinstance(b, (int, long))) | 443 self.assertTrue(isinstance(b, types)) |
439 self.assertEqual(10, b) | 444 self.assertEqual(10, b) |
440 | 445 |
441 # This is the QIDO-RS testing | 446 # This is the QIDO-RS testing |
442 a = DoGet(ORTHANC, '/dicom-web/studies') | 447 a = DoGet(ORTHANC, '/dicom-web/studies') |
443 self.assertEqual(1, len(a)) | 448 self.assertEqual(1, len(a)) |
444 self.assertEqual('IS', a[0]['00201208']['vr']) # Number of Study Related Instances | 449 self.assertEqual('IS', a[0]['00201208']['vr']) # Number of Study Related Instances |
445 | 450 |
446 b = a[0]['00201208']['Value'][0] | 451 b = a[0]['00201208']['Value'][0] |
447 self.assertTrue(isinstance(b, (int, long))) | 452 self.assertTrue(isinstance(b, types)) |
448 self.assertEqual(1, b) | 453 self.assertEqual(1, b) |
449 | 454 |
450 | 455 |
451 def test_bitbucket_issue_113(self): | 456 def test_bitbucket_issue_113(self): |
452 # Wrong serialization of PN VR | 457 # Wrong serialization of PN VR |
484 | 489 |
485 UploadInstance(ORTHANC, 'LenaTwiceWithFragments.dcm') | 490 UploadInstance(ORTHANC, 'LenaTwiceWithFragments.dcm') |
486 | 491 |
487 a = DoGet(ORTHANC, '/dicom-web/instances') | 492 a = DoGet(ORTHANC, '/dicom-web/instances') |
488 self.assertEqual(1, len(a)) | 493 self.assertEqual(1, len(a)) |
494 self.assertEqual(2, a[0]['00280008']['Value'][0]) # Number of frames | |
495 self.assertEqual(512, a[0]['00280010']['Value'][0]) # Rows | |
496 self.assertEqual(512, a[0]['00280011']['Value'][0]) # Columns | |
497 self.assertEqual(8, a[0]['00280100']['Value'][0]) # Bits allocated | |
498 | |
489 url = a[0]['00081190']['Value'][0] | 499 url = a[0]['00081190']['Value'][0] |
490 | 500 |
491 prefix = 'http://localhost:8042' | 501 prefix = 'http://localhost:8042' |
492 self.assertTrue(url.startswith(prefix)) | 502 self.assertTrue(url.startswith(prefix)) |
493 uri = url[len(prefix):] | 503 uri = url[len(prefix):] |
494 | 504 |
495 b = DoGetRaw(ORTHANC, '%s/frames/1' % uri, headers = { 'Accept' : 'multipart/related; type=application/octet-stream' }) | 505 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 0))) |
496 print b | 506 self.assertRaises(Exception, lambda: DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 3))) |
497 | 507 |
498 | 508 b = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 1)) |
509 self.assertEqual(1, len(b)) | |
510 self.assertEqual(512 * 512 * 3, len(b[0])) | |
511 | |
512 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 2)) | |
513 self.assertEqual(1, len(c)) | |
514 self.assertEqual(512 * 512 * 3, len(c[0])) | |
515 | |
516 self.assertEqual(b[0], c[0]) | |
517 | |
518 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 2), | |
519 headers = { 'Accept' : 'multipart/related; type=application/octet-stream' }) | |
520 self.assertEqual(1, len(c)) | |
521 self.assertEqual(b[0], c[0]) | |
522 | |
523 c = DoGetMultipart(ORTHANC, '%s/frames/%d' % (uri, 2), | |
524 headers = { 'Accept' : 'multipart/related; type="application/octet-stream"' }) | |
525 self.assertEqual(1, len(c)) | |
526 self.assertEqual(b[0], c[0]) | |
527 | |
528 | |
499 try: | 529 try: |
500 print('\nStarting the tests...') | 530 print('\nStarting the tests...') |
501 unittest.main(argv = [ sys.argv[0] ] + args.options) | 531 unittest.main(argv = [ sys.argv[0] ] + args.options) |
502 | 532 |
503 finally: | 533 finally: |