Mercurial > hg > orthanc-tests
comparison Tests/Tests.py @ 208:2444c9a7c422 Orthanc-1.5.3
test_bitbucket_issue_90
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 24 Jan 2019 18:01:52 +0100 |
parents | a515eec74078 |
children | 2c50c8f340c2 |
comparison
equal
deleted
inserted
replaced
207:a515eec74078 | 208:2444c9a7c422 |
---|---|
4313 | 4313 |
4314 def test_invalid_findscp(self): | 4314 def test_invalid_findscp(self): |
4315 UploadInstance(_REMOTE, 'DummyCT.dcm') | 4315 UploadInstance(_REMOTE, 'DummyCT.dcm') |
4316 findscu = CallFindScu([ '-S', '-k', '8,52=IMAGE', '-k', '8,16', '-k', '2,2' ]) | 4316 findscu = CallFindScu([ '-S', '-k', '8,52=IMAGE', '-k', '8,16', '-k', '2,2' ]) |
4317 self.assertEqual(0, len(re.findall('\(0002,0002\)', findscu))) | 4317 self.assertEqual(0, len(re.findall('\(0002,0002\)', findscu))) |
4318 | |
4319 | |
4320 def test_bitbucket_issue_90(self): | |
4321 def CountDicomResults(sex): | |
4322 a = CallFindScu([ '-S', '-k', '8,52=STUDY', '-k', sex ]) | |
4323 return len(re.findall('\(0010,0040\)', a)) | |
4324 | |
4325 def CountRestResults(sex): | |
4326 a = DoPost(_REMOTE, '/tools/find', | |
4327 { 'Level' : 'Study', 'Query' : { 'PatientSex' : sex } }) | |
4328 return len(a) | |
4329 | |
4330 # Just like the "CR000000.dcm" of the issue, the test image | |
4331 # "DummyCT.dcm" has the tag PatientSex (0010,0040) unset | |
4332 UploadInstance(_REMOTE, 'DummyCT.dcm') | |
4333 | |
4334 # Test that the behavior of DICOM vs. REST API is consistent on missing tags | |
4335 | |
4336 # In wildcard constraints, the patient sex must be set for a match to occur | |
4337 self.assertEqual(0, CountDicomResults('PatientSex=*')) | |
4338 self.assertEqual(0, CountRestResults('*')) | |
4339 | |
4340 # In single-valued constraints, the patient sex must be set | |
4341 self.assertEqual(0, CountDicomResults('PatientSex=F')) | |
4342 self.assertEqual(0, CountDicomResults('PatientSex=M')) | |
4343 self.assertEqual(0, CountRestResults('F')) | |
4344 self.assertEqual(0, CountRestResults('M')) | |
4345 | |
4346 # Empty constraints are only used to ask the actual value of | |
4347 # the tag to be added to the *answer*. The tag should not used | |
4348 # as a filter in such a situation. | |
4349 self.assertEqual(1, CountDicomResults('PatientSex')) | |
4350 self.assertEqual(1, CountDicomResults('PatientSex=')) | |
4351 self.assertEqual(1, CountRestResults('')) # This check fails on Orthanc <= 1.5.2 (issue 90) |