MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_ssl_arguments

Method test_ssl_arguments

test/dialect/mysql/test_dialect.py:348–376  ·  view source on GitHub ↗
(self, driver_name)

Source from the content-addressed store, hash-verified

346 ("mysqldb"), ("pymysql"), id_="s", argnames="driver_name"
347 )
348 def test_ssl_arguments(self, driver_name):
349 url = (
350 "mysql+%s://scott:tiger@localhost:3306/test"
351 "?ssl_ca=/ca.pem&ssl_cert=/cert.pem&ssl_key=/key.pem" % driver_name
352 )
353 url_obj = make_url(url)
354 dialect = url_obj.get_dialect()()
355
356 expected = {
357 "{}".format(
358 "password" if driver_name == "pymysql" else "passwd"
359 ): "tiger",
360 "{}".format(
361 "database" if driver_name == "pymysql" else "db"
362 ): "test",
363 "ssl": {"ca": "/ca.pem", "cert": "/cert.pem", "key": "/key.pem"},
364 "host": "localhost",
365 "user": "scott",
366 "port": 3306,
367 }
368 # add check_hostname check for mysqldb and pymysql
369 if driver_name in ["mysqldb", "pymysql"]:
370 url = url + "&ssl_check_hostname=false"
371 expected["ssl"]["check_hostname"] = False
372
373 kwarg = dialect.create_connect_args(make_url(url))[1]
374 for k in ("use_unicode", "found_rows", "client_flag"):
375 kwarg.pop(k, None)
376 eq_(kwarg, expected)
377
378 @testing.combinations(
379 ("compress", True),

Callers

nothing calls this directly

Calls 5

make_urlFunction · 0.90
eq_Function · 0.90
get_dialectMethod · 0.45
create_connect_argsMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected