MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_tlsCertificateKeyFilePassword

Method test_tlsCertificateKeyFilePassword

test/test_ssl.py:165–201  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

163 @client_context.require_no_api_version
164 @ignore_deprecations
165 def test_tlsCertificateKeyFilePassword(self):
166 # Expects the server to be running with server.pem and ca.pem
167 #
168 # --sslPEMKeyFile=/path/to/pymongo/test/certificates/server.pem
169 # --sslCAFile=/path/to/pymongo/test/certificates/ca.pem
170 if not hasattr(ssl, "SSLContext") and not HAVE_PYSSL:
171 self.assertRaises(
172 ConfigurationError,
173 self.simple_client,
174 "localhost",
175 ssl=True,
176 tlsCertificateKeyFile=CLIENT_ENCRYPTED_PEM,
177 tlsCertificateKeyFilePassword="qwerty",
178 tlsCAFile=CA_PEM,
179 serverSelectionTimeoutMS=1000,
180 )
181 else:
182 connected(
183 self.simple_client(
184 "localhost",
185 ssl=True,
186 tlsCertificateKeyFile=CLIENT_ENCRYPTED_PEM,
187 tlsCertificateKeyFilePassword="qwerty",
188 tlsCAFile=CA_PEM,
189 serverSelectionTimeoutMS=5000,
190 **self.credentials, # type: ignore[arg-type]
191 )
192 )
193
194 uri_fmt = (
195 "mongodb://localhost/?ssl=true"
196 "&tlsCertificateKeyFile=%s&tlsCertificateKeyFilePassword=qwerty"
197 "&tlsCAFile=%s&serverSelectionTimeoutMS=5000"
198 )
199 connected(
200 self.simple_client(uri_fmt % (CLIENT_ENCRYPTED_PEM, CA_PEM), **self.credentials) # type: ignore[arg-type]
201 )
202
203 @client_context.require_tlsCertificateKeyFile
204 @client_context.require_no_auth

Callers

nothing calls this directly

Calls 2

connectedFunction · 0.90
simple_clientMethod · 0.45

Tested by

no test coverage detected