diff Tests/Tests.py @ 527:86456045ac80 Orthanc-1.12.0

added test_numeric_metadata
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 14 Apr 2023 12:12:44 +0200
parents 3112c7f2326e
children 53cf0e3ad007
line wrap: on
line diff
--- a/Tests/Tests.py	Wed Apr 12 12:01:23 2023 +0200
+++ b/Tests/Tests.py	Fri Apr 14 12:12:44 2023 +0200
@@ -9544,3 +9544,37 @@
             
         else:
             print("Your database backend doesn't support labels")
+
+
+    def test_numeric_metadata(self):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 0):
+            instance = UploadInstance(_REMOTE, 'DummyCT.dcm')['ID']
+            study = DoGet(_REMOTE, '/instances/%s/study' % instance)['ID']
+
+            m = DoGet(_REMOTE, '/studies/%s/metadata' % study)
+            self.assertEqual(2, len(m))
+            self.assertTrue('LastUpdate' in m)
+            self.assertTrue('MainDicomTagsSignature' in m)
+            lastUpdate = DoGet(_REMOTE, '/studies/%s/metadata/%s' % (study, 'LastUpdate'))
+            signature = DoGet(_REMOTE, '/studies/%s/metadata/%s' % (study, 'MainDicomTagsSignature'))
+            
+            m = DoGet(_REMOTE, '/studies/%s/metadata?numeric' % study)
+            self.assertEqual(2, len(m))
+            self.assertTrue(7 in m)   # MetadataType_LastUpdate
+            self.assertTrue(15 in m)  # MetadataType_MainDicomTagsSignature
+            self.assertEqual(lastUpdate, DoGet(_REMOTE, '/studies/%s/metadata/%d' % (study, 7)))
+            self.assertEqual(signature, DoGet(_REMOTE, '/studies/%s/metadata/%d' % (study, 15)))
+
+            m = DoGet(_REMOTE, '/studies/%s/metadata?expand' % study)
+            self.assertEqual(2, len(m))
+            self.assertTrue('LastUpdate' in m)
+            self.assertTrue('MainDicomTagsSignature' in m)
+            self.assertEqual(lastUpdate, m['LastUpdate'])
+            self.assertEqual(signature, m['MainDicomTagsSignature'])
+            
+            m = DoGet(_REMOTE, '/studies/%s/metadata?expand&numeric' % study)
+            self.assertEqual(2, len(m))
+            self.assertTrue('7' in m)
+            self.assertTrue('15' in m)
+            self.assertEqual(lastUpdate, m['7'])
+            self.assertEqual(signature, m['15'])