comparison Tests/Tests.py @ 698:7282c2df963d

tests for new DICOMWeb JSON DS handling
author Alain Mazy <am@orthanc.team>
date Wed, 25 Sep 2024 19:37:06 +0200
parents b2c3ba1adf55
children
comparison
equal deleted inserted replaced
697:b2c3ba1adf55 698:7282c2df963d
5483 self.assertEqual('Inconsistent', DoGet(_REMOTE, '/series/%s' % series)['Status']) 5483 self.assertEqual('Inconsistent', DoGet(_REMOTE, '/series/%s' % series)['Status'])
5484 self.assertFalse(HasCompletedInChanges()) 5484 self.assertFalse(HasCompletedInChanges())
5485 5485
5486 5486
5487 def test_dicomweb(self): 5487 def test_dicomweb(self):
5488 def Compare(dicom, reference): 5488 if IsOrthancVersionAbove(_LOCAL, 1, 12, 5) and DoGet(_REMOTE, '/system')['ApiVersion'] >= 26: # the references have changed with 1.12.5 -> we don't want to keep 2 references
5489 a = UploadInstance(_REMOTE, dicom) ['ID'] 5489 def Compare(dicom, reference):
5490 b = DoGet(_REMOTE, '/instances/%s/file' % a, 5490 a = UploadInstance(_REMOTE, dicom) ['ID']
5491 headers = { 'Accept' : 'application/dicom+json' }) 5491 b = DoGet(_REMOTE, '/instances/%s/file' % a,
5492 with open(GetDatabasePath(reference), 'rb') as c: 5492 headers = { 'Accept' : 'application/dicom+json' })
5493 d = json.load(c) 5493 with open(GetDatabasePath(reference), 'rb') as c:
5494 AssertAlmostEqualRecursive(self, d, b) 5494 d = json.load(c)
5495 5495 AssertAlmostEqualRecursive(self, d, b)
5496 Compare('DummyCT.dcm', 'DummyCT.json') 5496
5497 Compare('MarekLatin2.dcm', 'MarekLatin2.json') 5497 Compare('DummyCT.dcm', 'DummyCT.json')
5498 Compare('HierarchicalAnonymization/StructuredReports/IM0', 5498 Compare('MarekLatin2.dcm', 'MarekLatin2.json')
5499 'HierarchicalAnonymization/StructuredReports/IM0.json') 5499 Compare('HierarchicalAnonymization/StructuredReports/IM0',
5500 'HierarchicalAnonymization/StructuredReports/IM0.json')
5500 5501
5501 5502
5502 def test_issue_95_encodings(self): 5503 def test_issue_95_encodings(self):
5503 # https://bugs.orthanc-server.com/show_bug.cgi?id=95 5504 # https://bugs.orthanc-server.com/show_bug.cgi?id=95
5504 # Check out image: "../Database/Encodings/DavidClunie/charsettests.screenshot.png" 5505 # Check out image: "../Database/Encodings/DavidClunie/charsettests.screenshot.png"