File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,22 +118,28 @@ def __init__(
118118 self .__headers .update ({"User-Agent" : generate_user_agent ()})
119119
120120 if self .__secure :
121- https = urllib3 .PoolManager (
121+ self . __manager = urllib3 .PoolManager (
122122 cert_reqs = "CERT_REQUIRED" ,
123123 assert_hostname = False ,
124124 ca_certs = self .__cert ,
125125 headers = self .__headers ,
126126 )
127- self .__session = https .request
127+ self .__session = self . __manager .request
128128 else :
129- https = urllib3 .PoolManager (
129+ self . __manager = urllib3 .PoolManager (
130130 headers = self .__headers
131131 )
132- self .__session = https .request
132+ self .__session = self . __manager .request
133133
134134 def __del__ (self ):
135- del self .__session
136-
135+ self .close_connection ()
136+
137+ def close_connection (self ):
138+ """
139+ Close all currently open connections to the OPA server
140+ """
141+ self .__manager .clear ()
142+
137143 def check_connection (self ):
138144 """
139145 Checks whether established connection config True or not.
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ def setUp(self):
2121
2222 def tearDown (self ):
2323 '''her bir testden sonra run olur'''
24- pass
24+ """ Close the connection to the OPA server by deleting the client"""
25+ del self .myclient
2526
2627 def test_client (self ):
2728
@@ -138,4 +139,4 @@ def test_functions(self):
138139
139140
140141
141-
142+
You can’t perform that action at this time.
0 commit comments