changeset 538:7a83a8f087c7

LastUpdate when deleting resources
author Alain Mazy <am@osimis.io>
date Mon, 22 May 2023 17:59:18 +0200
parents 23d577e9a32f
children ef41b62b456e
files Tests/Tests.py
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Mon May 22 15:06:56 2023 +0200
+++ b/Tests/Tests.py	Mon May 22 17:59:18 2023 +0200
@@ -9590,3 +9590,27 @@
         if IsOrthancVersionAbove(_REMOTE, 1, 12, 1): # till 1.12.0, it returned a 200
             (headers, body) = DoPutRaw(_REMOTE, '/instances/11111111-11111111-11111111-11111111-11111111/attachments/1025', 'hello')
             self.assertEqual('404', headers['status'])
+
+    def test_delete_updates_parents_last_update_metadata(self):
+        if IsOrthancVersionAbove(_REMOTE, 1, 12, 1):
+            i = UploadInstance(_REMOTE, 'Beaufix/IM-0001-0001.dcm')
+            j = UploadInstance(_REMOTE, 'Beaufix/IM-0001-0002.dcm')
+            
+            #instanceLastUpdate1 = DoGet(_REMOTE, '/instances/%s/metadata/LastUpdate' % i['ID'])
+            seriesLastUpdate1 = DoGet(_REMOTE, '/series/%s/metadata/LastUpdate' % i['ParentSeries'])
+            studyLastUpdate1 = DoGet(_REMOTE, '/studies/%s/metadata/LastUpdate' % i['ParentStudy'])
+            patientLastUpdate1 = DoGet(_REMOTE, '/patients/%s/metadata/LastUpdate' % i['ParentPatient'])
+            
+            time.sleep(1.01)
+            DoDelete(_REMOTE, '/instances/%s' % j['ID'])
+
+            #instanceLastUpdate2 = DoGet(_REMOTE, '/instances/%s/metadata/LastUpdate' % i['ID'])
+            seriesLastUpdate2 = DoGet(_REMOTE, '/series/%s/metadata/LastUpdate' % i['ParentSeries'])
+            studyLastUpdate2 = DoGet(_REMOTE, '/studies/%s/metadata/LastUpdate' % i['ParentStudy'])
+            patientLastUpdate2 = DoGet(_REMOTE, '/patients/%s/metadata/LastUpdate' % i['ParentPatient'])
+
+            #self.assertEqual(instanceLastUpdate1, instanceLastUpdate2)
+            self.assertNotEqual(seriesLastUpdate1, seriesLastUpdate2)
+            self.assertNotEqual(studyLastUpdate1, studyLastUpdate2)
+            self.assertNotEqual(patientLastUpdate1, patientLastUpdate2)
+