@@ -151,24 +151,26 @@ async def test_ssl_certificate(self) -> None:
151151 uuid1 = "3ea4e610-f276-4715-aa52-88d1cf14a295"
152152 uuid2 = "4c535672-949e-480f-9df4-9548a4cc2c1f"
153153
154+ path = os .path .abspath (os .path .dirname (os .path .realpath (__file__ )))
155+
154156 # Configure the server SSL context for client authentication,
155157 # load the server's certificate and key, and set up the CA certificate for verification.
156158 server_ssl_context = ssl .create_default_context (ssl .Purpose .CLIENT_AUTH )
157159 server_ssl_context .load_cert_chain (
158- certfile = f"certs_ca/server_{ uuid1 } .cert" ,
159- keyfile = f"certs_ca/server_{ uuid1 } .key" ,
160+ certfile = f"{ path } / certs_ca/server_{ uuid1 } .cert" ,
161+ keyfile = f"{ path } / certs_ca/server_{ uuid1 } .key" ,
160162 )
161- server_ssl_context .load_verify_locations (cafile = " certs_ca/ca.cert" )
163+ server_ssl_context .load_verify_locations (cafile = f" { path } / certs_ca/ca.cert" )
162164 server_ssl_context .verify_mode = ssl .CERT_REQUIRED
163165
164166 # Configure the client SSL context for server authentication,
165167 # load the client's certificate and key, and set up the CA certificate for verification.
166168 client_ssl_context = ssl .create_default_context (ssl .Purpose .SERVER_AUTH )
167169 client_ssl_context .load_cert_chain (
168- certfile = f"certs_ca/client_{ uuid1 } .cert" ,
169- keyfile = f"certs_ca/client_{ uuid1 } .key" ,
170+ certfile = f"{ path } / certs_ca/client_{ uuid1 } .cert" ,
171+ keyfile = f"{ path } / certs_ca/client_{ uuid1 } .key" ,
170172 )
171- client_ssl_context .load_verify_locations (cafile = " certs_ca/ca.cert" )
173+ client_ssl_context .load_verify_locations (cafile = f" { path } / certs_ca/ca.cert" )
172174 client_ssl_context .verify_mode = ssl .CERT_REQUIRED
173175
174176 # Initialize the ChaskiStreamer instance for the producer, configuring SSL contexts
@@ -187,20 +189,20 @@ async def test_ssl_certificate(self) -> None:
187189 # load the second server's certificate and key, and set up the CA certificate for verification.
188190 server_ssl_context2 = ssl .create_default_context (ssl .Purpose .CLIENT_AUTH )
189191 server_ssl_context2 .load_cert_chain (
190- certfile = f"certs_ca/server_{ uuid2 } .cert" ,
191- keyfile = f"certs_ca/server_{ uuid2 } .key" ,
192+ certfile = f"{ path } / certs_ca/server_{ uuid2 } .cert" ,
193+ keyfile = f"{ path } / certs_ca/server_{ uuid2 } .key" ,
192194 )
193- server_ssl_context2 .load_verify_locations (cafile = " certs_ca/ca.cert" )
195+ server_ssl_context2 .load_verify_locations (cafile = f" { path } / certs_ca/ca.cert" )
194196 server_ssl_context2 .verify_mode = ssl .CERT_REQUIRED
195197
196198 # Configure the second client SSL context for server authentication,
197199 # load the client's certificate and key, and set up the CA certificate for verification.
198200 client_ssl_context2 = ssl .create_default_context (ssl .Purpose .SERVER_AUTH )
199201 client_ssl_context2 .load_cert_chain (
200- certfile = f"certs_ca/client_{ uuid2 } .cert" ,
201- keyfile = f"certs_ca/client_{ uuid2 } .key" ,
202+ certfile = f"{ path } / certs_ca/client_{ uuid2 } .cert" ,
203+ keyfile = f"{ path } / certs_ca/client_{ uuid2 } .key" ,
202204 )
203- client_ssl_context2 .load_verify_locations (cafile = " certs_ca/ca.cert" )
205+ client_ssl_context2 .load_verify_locations (cafile = f" { path } / certs_ca/ca.cert" )
204206 client_ssl_context2 .verify_mode = ssl .CERT_REQUIRED
205207
206208 # Initialize the ChaskiStreamer instance for the consumer, configuring SSL contexts
0 commit comments