changeset 128:a9fdfcb696e6

added tests for ?expand in /peers and /modalities
author amazy
date Tue, 05 Dec 2017 12:42:26 +0100
parents 1eea4d3a1ba9
children 53d522dd4a38
files Tests/Tests.py
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Tests/Tests.py	Sun Oct 08 11:45:43 2017 +0200
+++ b/Tests/Tests.py	Tue Dec 05 12:42:26 2017 +0100
@@ -1260,6 +1260,8 @@
         DoPut(_REMOTE, '/modalities/tata', [ "STORESCP", "localhost", 2000, 'GenericNoUniversalWildcard' ])
         DoDelete(_REMOTE, '/modalities/tata')
         DoPut(_REMOTE, '/modalities/tata', [ "STORESCP", "localhost", 2000, 'GenericNoWildcardInDates' ])
+        modalitiesReadback = DoGet(_REMOTE, '/modalities?expand')
+        self.assertEqual([ "STORESCP", "localhost", 2000, 'GenericNoWildcardInDates' ], modalitiesReadback['tata'])
         self.assertRaises(Exception, lambda: DoPut(_REMOTE, '/modalities/toto', [ "STORESCP", "localhost", 2000, 'InvalidManufacturerName' ]))
         self.assertTrue('store' in DoGet(_REMOTE, '/modalities/toto'))
         self.assertTrue('store' in DoGet(_REMOTE, '/modalities/tata'))
@@ -1282,6 +1284,15 @@
         self.assertRaises(Exception, lambda: DoGet(_REMOTE, '/peers/toto'))
         DoPut(_REMOTE, '/peers/toto', [ 'http://localhost:8042/' ])
         DoPut(_REMOTE, '/peers/tata', [ 'http://localhost:8042/', 'user', 'pass' ])
+        self.assertTrue('tata' in DoGet(_REMOTE, '/peers'))
+        peersReadback = DoGet(_REMOTE, '/peers?expand')
+        self.assertEqual('http://localhost:8042/', peersReadback['tata']['Url'])
+        self.assertEqual('user', peersReadback['tata']['Username'])
+        self.assertFalse('Password' in peersReadback['tata']) # make sure no sensitive data is included
+        self.assertFalse('CertificateFile' in peersReadback['tata']) # make sure no sensitive data is included
+        self.assertFalse('CertificateKeyFile' in peersReadback['tata']) # make sure no sensitive data is included
+        self.assertFalse('CertificateKeyPassword' in peersReadback['tata']) # make sure no sensitive data is included
+        self.assertFalse('Pkcs11' in peersReadback['tata']) # make sure no sensitive data is included
         self.assertRaises(Exception, lambda: DoPut(_REMOTE, '/peers/toto', [ 'http://localhost:8042/', 'a' ]))
         self.assertRaises(Exception, lambda: DoPut(_REMOTE, '/peers/toto', [ 'http://localhost:8042/', 'a', 'b', 'c' ]))
         self.assertTrue('store' in DoGet(_REMOTE, '/peers/toto'))