Mercurial > hg > orthanc-tests
comparison Tests/Tests.py @ 319:de6e73e4df60 Orthanc-1.7.2
leaving bitbucket
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 30 Jun 2020 16:14:30 +0200 |
parents | bac7cc80f240 |
children | 33b79d82a83c |
comparison
equal
deleted
inserted
replaced
318:bac7cc80f240 | 319:de6e73e4df60 |
---|---|
3419 | 3419 |
3420 self.assertIn('OK', result) | 3420 self.assertIn('OK', result) |
3421 | 3421 |
3422 | 3422 |
3423 def test_bitbucket_issue_44(self): | 3423 def test_bitbucket_issue_44(self): |
3424 # https://bitbucket.org/sjodogne/orthanc/issues/44/bad-interpretation-of-photometric | 3424 # https://bugs.orthanc-server.com/show_bug.cgi?id=44 |
3425 UploadInstance(_REMOTE, 'Issue44/Monochrome1.dcm') | 3425 UploadInstance(_REMOTE, 'Issue44/Monochrome1.dcm') |
3426 UploadInstance(_REMOTE, 'Issue44/Monochrome2.dcm') | 3426 UploadInstance(_REMOTE, 'Issue44/Monochrome2.dcm') |
3427 | 3427 |
3428 # dcmcjpeg +ua +eb Monochrome1.dcm Monochrome1-Jpeg.dcm | 3428 # dcmcjpeg +ua +eb Monochrome1.dcm Monochrome1-Jpeg.dcm |
3429 UploadInstance(_REMOTE, 'Issue44/Monochrome1-Jpeg.dcm') | 3429 UploadInstance(_REMOTE, 'Issue44/Monochrome1-Jpeg.dcm') |
3459 # white (255), should be rendered as white (255) | 3459 # white (255), should be rendered as white (255) |
3460 self.assertEqual(255, im.getpixel((0,0))) | 3460 self.assertEqual(255, im.getpixel((0,0))) |
3461 | 3461 |
3462 | 3462 |
3463 def test_bitbucket_issue_42(self): | 3463 def test_bitbucket_issue_42(self): |
3464 # https://bitbucket.org/sjodogne/orthanc/issues/42/fails-to-modify-a-dicom-video-file | 3464 # https://bugs.orthanc-server.com/show_bug.cgi?id=42 |
3465 # This test fails on DCMTK 3.6.0, but succeeds in DCMTK 3.6.1 snapshots and DCMTK 3.6.2 | 3465 # This test fails on DCMTK 3.6.0, but succeeds in DCMTK 3.6.1 snapshots and DCMTK 3.6.2 |
3466 UploadInstance(_REMOTE, 'Issue42.dcm')['ID'] | 3466 UploadInstance(_REMOTE, 'Issue42.dcm')['ID'] |
3467 modified = DoPost(_REMOTE, | 3467 modified = DoPost(_REMOTE, |
3468 '/patients/da128605-e040d0c4-310615d2-3475da63-df2d1ef4/modify', | 3468 '/patients/da128605-e040d0c4-310615d2-3475da63-df2d1ef4/modify', |
3469 '{"Replace":{"PatientID":"Hello","PatientName":"Sample patient name"},"Force":true}', | 3469 '{"Replace":{"PatientID":"Hello","PatientName":"Sample patient name"},"Force":true}', |
3471 self.assertTrue('PatientID' in modified) | 3471 self.assertTrue('PatientID' in modified) |
3472 | 3472 |
3473 | 3473 |
3474 def test_rest_find_limit(self): | 3474 def test_rest_find_limit(self): |
3475 # Check the "Since" and "Limit" parameters in URI "/tools/find" | 3475 # Check the "Since" and "Limit" parameters in URI "/tools/find" |
3476 # Related to issue 53: https://bitbucket.org/sjodogne/orthanc/issues/53 | 3476 # Related to issue 53: https://bugs.orthanc-server.com/show_bug.cgi?id=53 |
3477 | 3477 |
3478 # Upload 6 instances | 3478 # Upload 6 instances |
3479 brainix = [] | 3479 brainix = [] |
3480 knee = [] | 3480 knee = [] |
3481 for i in range(2): | 3481 for i in range(2): |
3540 self.assertEqual(0, len(set(b) ^ set(knee))) | 3540 self.assertEqual(0, len(set(b) ^ set(knee))) |
3541 | 3541 |
3542 | 3542 |
3543 def test_bitbucket_issue_46(self): | 3543 def test_bitbucket_issue_46(self): |
3544 # "PHI remaining after anonymization" | 3544 # "PHI remaining after anonymization" |
3545 # https://bitbucket.org/sjodogne/orthanc/issues/46 | 3545 # https://bugs.orthanc-server.com/show_bug.cgi?id=46 |
3546 | 3546 |
3547 def GetAnonymizedTags(study, version): | 3547 def GetAnonymizedTags(study, version): |
3548 anonymized = DoPost(_REMOTE, '/studies/%s/anonymize' % study, | 3548 anonymized = DoPost(_REMOTE, '/studies/%s/anonymize' % study, |
3549 { 'DicomVersion' : version }, | 3549 { 'DicomVersion' : version }, |
3550 'application/json') ['ID'] | 3550 'application/json') ['ID'] |
3629 | 3629 |
3630 def test_bitbucket_issue_56(self): | 3630 def test_bitbucket_issue_56(self): |
3631 # Case-insensitive matching over accents. This test assumes | 3631 # Case-insensitive matching over accents. This test assumes |
3632 # that the "CaseSensitivePN" configuration option of Orthanc | 3632 # that the "CaseSensitivePN" configuration option of Orthanc |
3633 # is set to "false" (default value). | 3633 # is set to "false" (default value). |
3634 # https://bitbucket.org/sjodogne/orthanc/issues/56 | 3634 # https://bugs.orthanc-server.com/show_bug.cgi?id=56 |
3635 | 3635 |
3636 def Check(name, expected, expectedSensitive): | 3636 def Check(name, expected, expectedSensitive): |
3637 a = CallFindScu([ '-k', '0008,0005=ISO_IR 192', # Use UTF-8 | 3637 a = CallFindScu([ '-k', '0008,0005=ISO_IR 192', # Use UTF-8 |
3638 '-k', '0008,0052=PATIENT', | 3638 '-k', '0008,0052=PATIENT', |
3639 '-k', 'PatientName=%s' % name ]) | 3639 '-k', 'PatientName=%s' % name ]) |
3914 self.assertEqual(str(content1), str(content2)) | 3914 self.assertEqual(str(content1), str(content2)) |
3915 | 3915 |
3916 | 3916 |
3917 def test_bitbucket_issue_94(self): | 3917 def test_bitbucket_issue_94(self): |
3918 # "a simple instance modification should not modify FrameOfReferenceUID + ..." | 3918 # "a simple instance modification should not modify FrameOfReferenceUID + ..." |
3919 # https://bitbucket.org/sjodogne/orthanc/issues/94 | 3919 # https://bugs.orthanc-server.com/show_bug.cgi?id=94 |
3920 i = UploadInstance(_REMOTE, 'Issue94.dcm')['ID'] | 3920 i = UploadInstance(_REMOTE, 'Issue94.dcm')['ID'] |
3921 | 3921 |
3922 source = DoGet(_REMOTE, '/instances/%s/attachments/dicom/data' % i) | 3922 source = DoGet(_REMOTE, '/instances/%s/attachments/dicom/data' % i) |
3923 | 3923 |
3924 modified = DoPost(_REMOTE, '/instances/%s/modify' % i, | 3924 modified = DoPost(_REMOTE, '/instances/%s/modify' % i, |
4499 Compare('HierarchicalAnonymization/StructuredReports/IM0', | 4499 Compare('HierarchicalAnonymization/StructuredReports/IM0', |
4500 'HierarchicalAnonymization/StructuredReports/IM0.json') | 4500 'HierarchicalAnonymization/StructuredReports/IM0.json') |
4501 | 4501 |
4502 | 4502 |
4503 def test_issue_95_encodings(self): | 4503 def test_issue_95_encodings(self): |
4504 # https://bitbucket.org/sjodogne/orthanc/issues/95/server-cant-support-chinese | 4504 # https://bugs.orthanc-server.com/show_bug.cgi?id=95 |
4505 # Check out image: "../Database/Encodings/DavidClunie/charsettests.screenshot.png" | 4505 # Check out image: "../Database/Encodings/DavidClunie/charsettests.screenshot.png" |
4506 | 4506 |
4507 # Very useful tool: "file2" from package "file-kanji" | 4507 # Very useful tool: "file2" from package "file-kanji" |
4508 | 4508 |
4509 def GetPatientName(dicom): | 4509 def GetPatientName(dicom): |
4578 | 4578 |
4579 | 4579 |
4580 def test_bitbucket_issue_131(self): | 4580 def test_bitbucket_issue_131(self): |
4581 # "Orthanc PACS silently fails to C-MOVE due to duplicate | 4581 # "Orthanc PACS silently fails to C-MOVE due to duplicate |
4582 # StudyInstanceUID in it's database." | 4582 # StudyInstanceUID in it's database." |
4583 # https://bitbucket.org/sjodogne/orthanc/issues/131/orthanc-pacs-silently-fails-to-c-move-due | 4583 # https://bugs.orthanc-server.com/show_bug.cgi?id=131 |
4584 | 4584 |
4585 # Insert 2 instances, with the same StudyInstanceUID, but with | 4585 # Insert 2 instances, with the same StudyInstanceUID, but with |
4586 # different patient IDs. Orthanc will create 2 distincts | 4586 # different patient IDs. Orthanc will create 2 distincts |
4587 # patients, and the hierarchy of resources above the two | 4587 # patients, and the hierarchy of resources above the two |
4588 # instances will be fully disjoint. | 4588 # instances will be fully disjoint. |
4791 | 4791 |
4792 | 4792 |
4793 def test_bitbucket_issue_140(self): | 4793 def test_bitbucket_issue_140(self): |
4794 # "Modifying private tags with REST API changes VR from LO to | 4794 # "Modifying private tags with REST API changes VR from LO to |
4795 # UN." This test fails if DCMTK <= 3.6.1 (e.g. fails on Ubuntu 16.04). | 4795 # UN." This test fails if DCMTK <= 3.6.1 (e.g. fails on Ubuntu 16.04). |
4796 # https://bitbucket.org/sjodogne/orthanc/issues/140 | 4796 # https://bugs.orthanc-server.com/show_bug.cgi?id=140 |
4797 source = UploadInstance(_REMOTE, 'Issue140.dcm') ['ID'] | 4797 source = UploadInstance(_REMOTE, 'Issue140.dcm') ['ID'] |
4798 series = DoGet(_REMOTE, '/instances/%s' % source) ['ParentSeries'] | 4798 series = DoGet(_REMOTE, '/instances/%s' % source) ['ParentSeries'] |
4799 | 4799 |
4800 target = DoPost(_REMOTE, '/series/%s/modify' % series, { | 4800 target = DoPost(_REMOTE, '/series/%s/modify' % series, { |
4801 'Replace' : { 'RadioButton3' : 'aaabbbccc' }, | 4801 'Replace' : { 'RadioButton3' : 'aaabbbccc' }, |
4872 'Normalize' : False | 4872 'Normalize' : False |
4873 })) | 4873 })) |
4874 | 4874 |
4875 | 4875 |
4876 def test_bitbucket_issue_141(self): | 4876 def test_bitbucket_issue_141(self): |
4877 # https://bitbucket.org/sjodogne/orthanc/issues/141/ | 4877 # https://bugs.orthanc-server.com/show_bug.cgi?id=141 |
4878 a = UploadInstance(_REMOTE, 'Issue141.dcm') ['ID'] | 4878 a = UploadInstance(_REMOTE, 'Issue141.dcm') ['ID'] |
4879 study = '494c8037-b237f263-d8f15075-c8cb2280-daf39bd1' | 4879 study = '494c8037-b237f263-d8f15075-c8cb2280-daf39bd1' |
4880 | 4880 |
4881 with open(GetDatabasePath('HelloWorld.pdf'), 'rb') as f: | 4881 with open(GetDatabasePath('HelloWorld.pdf'), 'rb') as f: |
4882 pdf = f.read() | 4882 pdf = f.read() |
4898 UploadInstance(_REMOTE, '2019-06-17-VedranZdesic.dcm') | 4898 UploadInstance(_REMOTE, '2019-06-17-VedranZdesic.dcm') |
4899 DoPost(_REMOTE, '/studies/0c4aca1d-c107a241-6659d6aa-594c674a-a468b94a/modify', {}) | 4899 DoPost(_REMOTE, '/studies/0c4aca1d-c107a241-6659d6aa-594c674a-a468b94a/modify', {}) |
4900 | 4900 |
4901 | 4901 |
4902 def test_log_level(self): | 4902 def test_log_level(self): |
4903 # https://bitbucket.org/sjodogne/orthanc/issues/65/ | 4903 # https://bugs.orthanc-server.com/show_bug.cgi?id=65 |
4904 original = DoGet(_REMOTE, '/tools/log-level') | 4904 original = DoGet(_REMOTE, '/tools/log-level') |
4905 | 4905 |
4906 DoPut(_REMOTE, '/tools/log-level', 'default') | 4906 DoPut(_REMOTE, '/tools/log-level', 'default') |
4907 self.assertEqual('default', DoGet(_REMOTE, '/tools/log-level')) | 4907 self.assertEqual('default', DoGet(_REMOTE, '/tools/log-level')) |
4908 DoGet(_REMOTE, '/system') | 4908 DoGet(_REMOTE, '/system') |
5268 self.assertEqual(24, im.size[1]) | 5268 self.assertEqual(24, im.size[1]) |
5269 | 5269 |
5270 | 5270 |
5271 def test_bitbucket_issue_154(self): | 5271 def test_bitbucket_issue_154(self): |
5272 # "Matching against list of UID-s by C-MOVE" | 5272 # "Matching against list of UID-s by C-MOVE" |
5273 # https://bitbucket.org/sjodogne/orthanc/issues/154/ | 5273 # https://bugs.orthanc-server.com/show_bug.cgi?id=154 |
5274 a = UploadInstance(_REMOTE, 'Issue154-d1.dcm') ['ID'] | 5274 a = UploadInstance(_REMOTE, 'Issue154-d1.dcm') ['ID'] |
5275 b = UploadInstance(_REMOTE, 'Issue154-d2.dcm') ['ID'] | 5275 b = UploadInstance(_REMOTE, 'Issue154-d2.dcm') ['ID'] |
5276 | 5276 |
5277 study = '1.2.826.0.1.3680043.8.498.35214236271657363033644818354280454731' | 5277 study = '1.2.826.0.1.3680043.8.498.35214236271657363033644818354280454731' |
5278 series1 = '1.2.826.0.1.3680043.8.498.12243321927795467590791662266352305113' | 5278 series1 = '1.2.826.0.1.3680043.8.498.12243321927795467590791662266352305113' |