1919# limitations under the License.
2020
2121
22+ from socket import socket
23+ from ssl import SSLSocket
2224from unittest import TestCase
2325
2426from mock import patch
@@ -60,9 +62,6 @@ def test_session_that_dies_in_the_pool_will_not_be_given_out(self):
6062 session_2 = driver .session ()
6163 assert session_2 is not session_1
6264
63-
64- class RunTestCase (TestCase ):
65-
6665 def test_must_use_valid_url_scheme (self ):
6766 with self .assertRaises (ValueError ):
6867 GraphDatabase .driver ("x://xxx" )
@@ -83,6 +82,21 @@ def test_sessions_are_not_reused_if_still_in_use(self):
8382 session_1 .close ()
8483 assert session_1 is not session_2
8584
85+ def test_insecure_session_uses_insecure_socket (self ):
86+ driver = GraphDatabase .driver ("bolt://localhost" , secure = False )
87+ session = driver .session ()
88+ assert isinstance (session .connection .channel .socket , socket )
89+ session .close ()
90+
91+ def test_secure_session_uses_secure_socket (self ):
92+ driver = GraphDatabase .driver ("bolt://localhost" , secure = True )
93+ session = driver .session ()
94+ assert isinstance (session .connection .channel .socket , SSLSocket )
95+ session .close ()
96+
97+
98+ class RunTestCase (TestCase ):
99+
86100 def test_can_run_simple_statement (self ):
87101 session = GraphDatabase .driver ("bolt://localhost" ).session ()
88102 count = 0
0 commit comments