@@ -25,15 +25,30 @@ def test_connection_with_list_of_hosts_with_first_invalid
25
25
end
26
26
27
27
def test_simple_tls
28
- assert_equal :simple_tls , @ldap . check_encryption ( :ssl )
29
- assert_equal :simple_tls , @ldap . check_encryption ( 'SSL' )
30
- assert_equal :simple_tls , @ldap . check_encryption ( :simple_tls )
28
+ expected = { method : :simple_tls , tls_options : { } }
29
+ assert_equal expected , @ldap . check_encryption ( :ssl )
30
+ assert_equal expected , @ldap . check_encryption ( 'SSL' )
31
+ assert_equal expected , @ldap . check_encryption ( :simple_tls )
31
32
end
32
33
33
34
def test_start_tls
34
- assert_equal :start_tls , @ldap . check_encryption ( :tls )
35
- assert_equal :start_tls , @ldap . check_encryption ( 'TLS' )
36
- assert_equal :start_tls , @ldap . check_encryption ( :start_tls )
35
+ expected = { method : :start_tls , tls_options : { } }
36
+ assert_equal expected , @ldap . check_encryption ( :tls )
37
+ assert_equal expected , @ldap . check_encryption ( 'TLS' )
38
+ assert_equal expected , @ldap . check_encryption ( :start_tls )
39
+ end
40
+
41
+ def test_tls_validation
42
+ assert_equal ( { method : :start_tls , tls_options : OpenSSL ::SSL ::VERIFY_PEER } ,
43
+ @ldap . check_encryption ( :tls , true ) )
44
+ assert_equal ( { method : :start_tls , tls_options : { } } ,
45
+ @ldap . check_encryption ( :tls , false ) )
46
+ assert_equal ( { method : :start_tls , tls_options : { } } ,
47
+ @ldap . check_encryption ( :tls , nil ) )
48
+ assert_equal ( { method : :start_tls , tls_options : { } } ,
49
+ @ldap . check_encryption ( :tls , 'true' ) )
50
+ assert_equal ( { method : :start_tls , tls_options : { } } ,
51
+ @ldap . check_encryption ( :tls ) )
37
52
end
38
53
39
54
def test_search_delegator
0 commit comments