changeset 285:281a32ecc5c1

test_store_straight
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 03 Apr 2020 14:04:10 +0200
parents 7fa5c7a03137
children b55a7cb5ee02
files Tests/Tests.py
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Thu Mar 26 07:57:01 2020 +0100
+++ b/Tests/Tests.py	Fri Apr 03 14:04:10 2020 +0200
@@ -5428,3 +5428,24 @@
         self.assertEqual(1, len(DoGet(_REMOTE, '/instances')))
         DoPost(_REMOTE, '/storage-commitment/%s/remove' % transaction)
         self.assertEqual(0, len(DoGet(_REMOTE, '/instances')))
+
+
+    def test_store_straight(self):  # New in Orthanc 1.6.1
+        self.assertEqual(0, len(DoGet(_LOCAL, '/instances')))
+        self.assertEqual(0, len(DoGet(_REMOTE, '/instances')))
+
+        with open(GetDatabasePath('DummyCT.dcm'), 'rb') as f:
+            dicom = f.read()
+
+        self.assertRaises(Exception, lambda: DoPost(
+            _REMOTE, '/modalities/orthanctest/store-straight', 'nope', 'nope'))
+
+        answer = DoPost(_REMOTE, '/modalities/orthanctest/store-straight', dicom, 'nope')
+
+        self.assertEqual('1.2.840.10008.5.1.4.1.1.4',
+                         answer['SOPClassUID'])
+        self.assertEqual('1.2.840.113619.2.176.2025.1499492.7040.1171286242.109',
+                         answer['SOPInstanceUID'])
+        
+        self.assertEqual(1, len(DoGet(_LOCAL, '/instances')))
+        self.assertEqual(0, len(DoGet(_REMOTE, '/instances')))