changeset 241:adc6372b8820

dicomweb: test_add_server
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 12 Jun 2019 18:15:32 +0200
parents 0b1023060421
children c6ffdd0ea04b
files Plugins/DicomWeb/Run.py
diffstat 1 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/DicomWeb/Run.py	Wed Jun 12 12:14:52 2019 +0200
+++ b/Plugins/DicomWeb/Run.py	Wed Jun 12 18:15:32 2019 +0200
@@ -656,6 +656,43 @@
 
         self.assertEqual(405, e.exception[0])
         self.assertEqual("GET,POST", e.exception[1]['allow'])
+
+
+    def test_add_server(self):
+        try:
+            DoDelete(ORTHANC, '/dicom-web/servers/hello')
+        except:
+            pass
+        
+        l = DoGet(ORTHANC, '/dicom-web/servers')
+        self.assertEqual(1, len(l))
+        self.assertTrue('sample' in l)
+
+        url = 'http://localhost:8042/dicom-web/'
+        DoPut(ORTHANC, '/dicom-web/servers/hello', {
+            'Url': url,
+            'HttpHeaders' : {
+                'Hello' : 'World'
+            },
+            'Username' : 'bob',
+            'Password' : 'bob'
+            })
+
+        l = DoGet(ORTHANC, '/dicom-web/servers')
+        self.assertEqual(2, len(l))
+        self.assertTrue('sample' in l)        
+        self.assertTrue('hello' in l)        
+
+        s = DoGet(ORTHANC, '/dicom-web/servers?expand')
+        self.assertEqual(5, len(s['hello']))
+        self.assertEqual(url, s['hello']['Url'])
+        self.assertEqual('bob', s['hello']['Username'])
+        self.assertEqual(None, s['hello']['Password'])
+        self.assertFalse(s['hello']['Pkcs11'])
+        self.assertEqual(1, len(s['hello']['HttpHeaders']))
+        self.assertTrue('Hello' in s['hello']['HttpHeaders'])
+        
+        DoDelete(ORTHANC, '/dicom-web/servers/hello')
         
 try:
     print('\nStarting the tests...')