File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -118,22 +118,28 @@ def __init__(
118
118
self .__headers .update ({"User-Agent" : generate_user_agent ()})
119
119
120
120
if self .__secure :
121
- https = urllib3 .PoolManager (
121
+ self . __manager = urllib3 .PoolManager (
122
122
cert_reqs = "CERT_REQUIRED" ,
123
123
assert_hostname = False ,
124
124
ca_certs = self .__cert ,
125
125
headers = self .__headers ,
126
126
)
127
- self .__session = https .request
127
+ self .__session = self . __manager .request
128
128
else :
129
- https = urllib3 .PoolManager (
129
+ self . __manager = urllib3 .PoolManager (
130
130
headers = self .__headers
131
131
)
132
- self .__session = https .request
132
+ self .__session = self . __manager .request
133
133
134
134
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
+
137
143
def check_connection (self ):
138
144
"""
139
145
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):
21
21
22
22
def tearDown (self ):
23
23
'''her bir testden sonra run olur'''
24
- pass
24
+ """ Close the connection to the OPA server by deleting the client"""
25
+ del self .myclient
25
26
26
27
def test_client (self ):
27
28
@@ -138,4 +139,4 @@ def test_functions(self):
138
139
139
140
140
141
141
-
142
+
You can’t perform that action at this time.
0 commit comments