changeset 143:28d50ffac07d

test_metadata_origin
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 12 Jul 2018 17:40:58 +0200
parents 6d2bfbbd0c2d
children 7809fdf8056f
files Tests/Tests.py
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Thu Jul 12 14:44:37 2018 +0200
+++ b/Tests/Tests.py	Thu Jul 12 17:40:58 2018 +0200
@@ -3719,3 +3719,25 @@
         
         self.assertEqual(a, b)     # Modified DICOM
         self.assertNotEqual(a, c)  # Anonymized DICOM
+
+
+    def test_metadata_origin(self):
+        # Upload using the REST API
+        i = UploadInstance(_REMOTE, 'DummyCT.dcm')['ID']
+        self.assertEqual('RestApi', DoGet(_REMOTE, '/instances/%s/metadata/Origin' % i))
+        self.assertEqual('', DoGet(_REMOTE, '/instances/%s/metadata/RemoteAET' % i))
+        self.assertNotEqual('', DoGet(_REMOTE, '/instances/%s/metadata/RemoteIP' % i))
+        self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/instances/%s/metadata/CalledAET' % i))
+        self.assertEqual('alice', DoGet(_REMOTE, '/instances/%s/metadata/HttpUsername' % i))
+
+        DoDelete(_REMOTE, '/instances/%s' % i)
+
+        # Upload using the DICOM protocol
+        subprocess.check_call([ FindExecutable('storescu'),
+                                _REMOTE['Server'], str(_REMOTE['DicomPort']),
+                                GetDatabasePath('DummyCT.dcm') ])
+        self.assertEqual('DicomProtocol', DoGet(_REMOTE, '/instances/%s/metadata/Origin' % i))
+        self.assertEqual('STORESCU', DoGet(_REMOTE, '/instances/%s/metadata/RemoteAET' % i))
+        self.assertNotEqual('', DoGet(_REMOTE, '/instances/%s/metadata/RemoteIP' % i))
+        self.assertEqual('ANY-SCP', DoGet(_REMOTE, '/instances/%s/metadata/CalledAET' % i))
+        self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/instances/%s/metadata/HttpUsername' % i))