From ca88aa8124af067a99f77ed676b3d2b4a73cc995 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 27 Sep 2016 08:33:31 +0200 Subject: [PATCH] python/tests: add a second_connection() helper function This can be used to create a 2nd connection. Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider --- python/samba/tests/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/python/samba/tests/__init__.py b/python/samba/tests/__init__.py index 741f9840b3..62b2d99e04 100644 --- a/python/samba/tests/__init__.py +++ b/python/samba/tests/__init__.py @@ -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() -- 2.34.1