python/tests: add a second_connection() helper function
authorStefan Metzmacher <metze@samba.org>
Tue, 27 Sep 2016 06:33:31 +0000 (08:33 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 26 Oct 2016 09:20:20 +0000 (11:20 +0200)
This can be used to create a 2nd connection.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
python/samba/tests/__init__.py

index 741f9840b3ce2e2c65bbb12dc59618e94bb23b41..62b2d99e045f70e04482fa8986a9a3262e13e6d3 100644 (file)
@@ -281,6 +281,26 @@ class RawDCERPCTest(TestCase):
 
         self.connect()
 
+    def noop(self):
+        return
+
+    def second_connection(self, tcp_port=None):
+        c = RawDCERPCTest(methodName='noop')
+        c.do_ndr_print = self.do_ndr_print
+        c.do_hexdump = self.do_hexdump
+
+        c.host = self.host
+        c.target_hostname = self.target_hostname
+        if tcp_port is not None:
+            c.tcp_port = tcp_port
+        else:
+            c.tcp_port = self.tcp_port
+
+        c.settings = self.settings
+
+        c.connect()
+        return c
+
     def get_user_creds(self):
         c = Credentials()
         c.guess()