[CalendarServer-changes] [12312] twext/trunk/twext/who/ldap/test/test_service.py

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:22:32 PDT 2014


Revision: 12312
          http://trac.calendarserver.org//changeset/12312
Author:   wsanchez at apple.com
Date:     2014-01-11 14:00:27 -0800 (Sat, 11 Jan 2014)
Log Message:
-----------
Test useTLS separately.

Modified Paths:
--------------
    twext/trunk/twext/who/ldap/test/test_service.py

Modified: twext/trunk/twext/who/ldap/test/test_service.py
===================================================================
--- twext/trunk/twext/who/ldap/test/test_service.py	2014-01-11 21:56:19 UTC (rev 12311)
+++ twext/trunk/twext/who/ldap/test/test_service.py	2014-01-11 22:00:27 UTC (rev 12312)
@@ -113,20 +113,16 @@
             timeout=18,
             tlsCACertificateFile=FilePath("/path/to/cert"),
             tlsCACertificateDirectory=FilePath("/path/to/certdir"),
-            useTLS=True,
             debug=True,
         )
         connection = yield service._connect()
 
         self.assertEquals(
             connection.methods_called(),
-            sum(
-                (
-                    ["initialize"],
-                    ["set_option"] * 4,
-                    ["start_tls_s"],
-                ), []
-            )
+            [
+                "initialize",
+                "set_option", "set_option", "set_option", "set_option",
+            ]
         )
 
         opt = lambda k: connection.get_option(k)
@@ -136,8 +132,27 @@
         self.assertEquals(opt(ldap.OPT_X_TLS_CACERTDIR), "/path/to/certdir")
         self.assertEquals(opt(ldap.OPT_DEBUG_LEVEL), 255)
 
+        self.assertFalse(connection.tls_enabled)
+
+
+    @inlineCallbacks
+    def test_connect_withSSL(self):
+        """
+        Connect with SSL enabled.
+        """
+        service = self.service(
+            useTLS=True,
+        )
+        connection = yield service._connect()
+
+        self.assertEquals(
+            connection.methods_called(),
+            ["initialize", "start_tls_s"]
+        )
+
         self.assertTrue(connection.tls_enabled)
 
 
+
 mockDirectoryData = dict(
 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/d5327cf0/attachment.html>


More information about the calendarserver-changes mailing list