comparison Tests/Tests.py @ 266:b105bb2233c6

author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 25 Feb 2020 21:44:28 +0100
parents 8d63d035b837
children f30b5bfa9599
comparison
equal deleted inserted replaced
265:8d63d035b837 266:b105bb2233c6
2597 '8899-8899' : encoded 2597 '8899-8899' : encoded
2598 } 2598 }
2599 2599
2600 i = DoPost(_REMOTE, '/tools/create-dicom', 2600 i = DoPost(_REMOTE, '/tools/create-dicom',
2601 json.dumps({ 2601 json.dumps({
2602 'Tags' : tags 2602 'Tags' : tags,
2603 'PrivateCreator' : 'TestBinary',
2603 })) 2604 }))
2604 2605
2605 self.assertEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/PatientName' % i['ID']).strip()) 2606 self.assertEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/PatientName' % i['ID']).strip())
2606 self.assertEqual(binary, DoGet(_REMOTE, '/instances/%s/content/8899-8899' % i['ID']).strip()) 2607 self.assertEqual(binary, DoGet(_REMOTE, '/instances/%s/content/8899-8899' % i['ID']).strip())
2607 2608
2608 i = DoPost(_REMOTE, '/tools/create-dicom', 2609 i = DoPost(_REMOTE, '/tools/create-dicom',
2609 json.dumps({ 2610 json.dumps({
2610 'InterpretBinaryTags' : False, 2611 'InterpretBinaryTags' : False,
2611 'Tags' : tags 2612 'Tags' : tags,
2613 'PrivateCreator' : 'TestBinary',
2612 })) 2614 }))
2613 2615
2614 self.assertEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/PatientName' % i['ID']).strip()) 2616 self.assertEqual('Jodogne', DoGet(_REMOTE, '/instances/%s/content/PatientName' % i['ID']).strip())
2615 self.assertEqual(encoded, DoGet(_REMOTE, '/instances/%s/content/8899-8899' % i['ID'])[0:-1]) 2617 self.assertEqual(encoded, DoGet(_REMOTE, '/instances/%s/content/8899-8899' % i['ID'])[0:-1])
2616 2618
4770 self.assertEqual("1.2.3.4", aCtTags['StudyInstanceUID']) 4772 self.assertEqual("1.2.3.4", aCtTags['StudyInstanceUID'])
4771 self.assertEqual("1.2.3.4", aRtTags['StudyInstanceUID']) 4773 self.assertEqual("1.2.3.4", aRtTags['StudyInstanceUID'])
4772 self.assertEqual("1.2.3.4", aRtTags['ReferencedFrameOfReferenceSequence'][0]['RTReferencedStudySequence'][0]['ReferencedSOPInstanceUID']) 4774 self.assertEqual("1.2.3.4", aRtTags['ReferencedFrameOfReferenceSequence'][0]['RTReferencedStudySequence'][0]['ReferencedSOPInstanceUID'])
4773 4775
4774 4776
4775
4776 @unittest.skip('Not fixed yet in Orthanc')
4777 def test_bitbucket_issue_140(self): 4777 def test_bitbucket_issue_140(self):
4778 # "Modifying private tags with REST API changes VR from LO to
4779 # UN." This test fails if DCMTK <= 3.6.0.
4780 # https://bitbucket.org/sjodogne/orthanc/issues/140
4778 source = UploadInstance(_REMOTE, 'Issue140.dcm') ['ID'] 4781 source = UploadInstance(_REMOTE, 'Issue140.dcm') ['ID']
4779 series = DoGet(_REMOTE, '/instances/%s' % source) ['ParentSeries'] 4782 series = DoGet(_REMOTE, '/instances/%s' % source) ['ParentSeries']
4780 4783
4781 target = DoPost(_REMOTE, '/series/%s/modify' % series, { 4784 target = DoPost(_REMOTE, '/series/%s/modify' % series, {
4782 'Replace' : { 'RadioButton3' : 'aaabbbccc' } 4785 'Replace' : { 'RadioButton3' : 'aaabbbccc' },
4786 'PrivateCreator' : 'RadioLogic', # <= the trick is here
4783 }, 'application/json') ['ID'] 4787 }, 'application/json') ['ID']
4784 4788
4785 instances = DoGet(_REMOTE, '/series/%s/instances' % target) 4789 instances = DoGet(_REMOTE, '/series/%s/instances' % target)
4786 self.assertEqual(1, len(instances)) 4790 self.assertEqual(1, len(instances))
4787 4791