diff Tests/Tests.py @ 63:2652d562267a

test Origin metadata of instances
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 25 Nov 2015 10:33:08 +0100
parents f9c4ce95756f
children 369e439cdfd6
line wrap: on
line diff
--- a/Tests/Tests.py	Mon Nov 23 17:14:48 2015 +0100
+++ b/Tests/Tests.py	Wed Nov 25 10:33:08 2015 +0100
@@ -897,10 +897,14 @@
         self.assertEqual('LastUpdate', m[0])
 
         m = DoGet(_REMOTE, '/instances/%s/metadata' % i)
-        self.assertEqual(3, len(m))
+        self.assertEqual(4, len(m))
         self.assertTrue('IndexInSeries' in m)
         self.assertTrue('ReceptionDate' in m)
         self.assertTrue('RemoteAET' in m)
+        self.assertTrue('Origin' in m)
+        self.assertEqual(DoGet(_REMOTE, '/instances/%s/metadata/IndexInSeries' % i), 1)
+        self.assertEqual(DoGet(_REMOTE, '/instances/%s/metadata/Origin' % i), 'RestApi')
+        self.assertEqual(DoGet(_REMOTE, '/instances/%s/metadata/RemoteAET' % i), '')  # None, received by REST API
 
         # Play with custom metadata
         DoPut(_REMOTE, '/patients/%s/metadata/5555' % p, 'coucou')
@@ -1012,6 +1016,18 @@
                                 GetDatabasePath('ColorTestImageJ.dcm') ])
         self.assertEqual(1, len(DoGet(_REMOTE, '/patients')))
 
+        i = DoGet(_REMOTE, '/instances')
+        self.assertEqual(1, len(i))
+        m = DoGet(_REMOTE, '/instances/%s/metadata' % i[0])
+        self.assertEqual(4, len(m))
+        self.assertTrue('IndexInSeries' in m)
+        self.assertTrue('ReceptionDate' in m)
+        self.assertTrue('RemoteAET' in m)
+        self.assertTrue('Origin' in m)
+        self.assertEqual(DoGet(_REMOTE, '/instances/%s/metadata/IndexInSeries' % i[0]), 1)
+        self.assertEqual(DoGet(_REMOTE, '/instances/%s/metadata/Origin' % i[0]), 'DicomProtocol')
+        self.assertEqual(DoGet(_REMOTE, '/instances/%s/metadata/RemoteAET' % i[0]), 'STORESCU')
+
 
     def test_incoming_findscu(self):
         def CallFindScu(args):