Mercurial > hg > orthanc-tests
changeset 786:fbff56dc871e
test_order_by_non_existing_metadata
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 20 Feb 2025 17:55:02 +0100 |
parents | de1ee0264916 |
children | d753dc94de2c b739a6b6da46 |
files | Database/sample-pdf.dcm Tests/Tests.py |
diffstat | 2 files changed, 52 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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))