# HG changeset patch # User Alain Mazy # Date 1740070502 -3600 # Node ID fbff56dc871ef93c1b0dc2ca2a1772a2d3ce7d45 # Parent de1ee02649160b4c6be68773265a2e94b4fb1aef test_order_by_non_existing_metadata diff -r de1ee0264916 -r fbff56dc871e Database/sample-pdf.dcm Binary file Database/sample-pdf.dcm has changed diff -r de1ee0264916 -r fbff56dc871e Tests/Tests.py --- a/Tests/Tests.py Fri Feb 14 14:52:35 2025 +0100 +++ b/Tests/Tests.py Thu Feb 20 17:55:02 2025 +0100 @@ -11788,3 +11788,55 @@ self.assertEqual(11, int(resp['content-length'])) self.assertEqual('application/octet-stream', resp['content-type']) self.assertEqual('bytes 10-20/%d' % len(compressed), resp['content-range']) + + def test_order_by_non_existing_metadata(self): + if IsOrthancVersionAbove(_REMOTE, 1, 12, 7) and HasExtendedFind(_REMOTE): + r = UploadInstance(_REMOTE, 'sample-pdf.dcm') + + # order by a metadata that does not exist (PDF do not have IndexInSeries) + a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Instances', + 'ParentSeries': r['ParentSeries'], + 'Query' : { + }, + 'OrderBy' : [ + { + 'Type': 'Metadata', + 'Key': 'IndexInSeries', + 'Direction': 'ASC' + } + ] + }) + self.assertEqual(1, len(a)) + + a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Instances', + 'ParentSeries': r['ParentSeries'], + 'Query' : { + }, + 'OrderBy' : [ + { + 'Type': 'Metadata', + 'Key': '9876', + 'Direction': 'ASC' + } + ] + }) + self.assertEqual(1, len(a)) + + def test_order_by_non_existing_tag(self): + if IsOrthancVersionAbove(_REMOTE, 1, 12, 7) and HasExtendedFind(_REMOTE): + r = UploadInstance(_REMOTE, 'sample-pdf.dcm') + + # order by a DICOM Tag that does not exist (PDF do not have ROWS) + a = DoPost(_REMOTE, '/tools/find', { 'Level' : 'Instances', + 'ParentSeries': r['ParentSeries'], + 'Query' : { + }, + 'OrderBy' : [ + { + 'Type': 'DicomTag', + 'Key': 'Rows', + 'Direction': 'ASC' + } + ] + }) + self.assertEqual(1, len(a))