tests/ntlm_auth: Port ntlm_auth tests to python: ntlm_auth against winbindd
authorSamuel Cabrero <scabrero@suse.de>
Fri, 31 Aug 2018 12:26:59 +0000 (14:26 +0200)
committerNoel Power <npower@samba.org>
Wed, 19 Dec 2018 11:42:09 +0000 (12:42 +0100)
Port ntlm_auth bash script tests to python

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Noel Power <npower@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/ntlm_auth.py
source3/script/tests/test_ntlm_auth_s3.sh

index 97e4b979c1794f066c8e22b40c2265fb678e12bd..4bfb37e7a554c5be639a91836f664c2e02b0e3e4 100644 (file)
@@ -23,6 +23,12 @@ from samba.compat import get_string
 
 class NTLMAuthHelpersTests(NTLMAuthTestCase):
 
+    def setUp(self):
+        super(NTLMAuthHelpersTests, self).setUp()
+        self.username = os.environ["DC_USERNAME"]
+        self.password = os.environ["DC_PASSWORD"]
+        self.domain = os.environ["DOMAIN"]
+
     def test_specified_domain(self):
         """ ntlm_auth with specified domain """
 
@@ -51,3 +57,12 @@ class NTLMAuthHelpersTests(NTLMAuthTestCase):
                               server_domain=domain,
                               server_use_winbind=False)
         self.assertTrue(ret)
+
+    def test_agaist_winbind(self):
+        """ ntlm_auth against winbindd """
+
+        ret = self.run_helper(client_username=self.username,
+                              client_password=self.password,
+                              client_domain=self.domain,
+                              server_use_winbind=True)
+        self.assertTrue(ret)
index 3d3d9f98048d11f78c11101301221ee6e0ba2066..3baed4acfb191f0829d7b7b17d796700de4efcb4 100755 (executable)
@@ -269,7 +269,6 @@ EOF
 }
 
 # This should work even with NTLMv2
-testit "ntlm_auth against winbindd" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd $ADDARGS || failed=`expr $failed + 1`
 testit "ntlm_auth with NTLMSSP client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=ntlmssp-client-1 --server-helper=gss-spnego || failed=`expr $failed + 1`
 testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH $ADDARGS --client-domain=fOo --server-domain=fOo --client-helper=gss-spnego-client --server-helper=gss-spnego || failed=`expr $failed + 1`
 testit "ntlm_auth with NTLMSSP gss-spnego-client and gss-spnego server against winbind" $PYTHON $SRC3DIR/torture/test_ntlm_auth.py $NTLM_AUTH --client-username=$USERNAME --client-domain=$DOMAIN --client-password=$PASSWORD --server-use-winbindd --client-helper=gss-spnego-client --server-helper=gss-spnego $ADDARGS || failed=`expr $failed + 1`