File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ class Gino(_Gino):
8282 * ``pool_min_size`` - the initial number of connections of the db pool.
8383 * ``pool_max_size`` - the maximum number of connections in the db pool.
8484 * ``echo`` - enable SQLAlchemy echo mode.
85+ * ``ssl`` - SSL context passed to ``asyncpg.connect``, default is ``None``.
8586
8687 If the ``db`` is set as an aiohttp middleware, then a lazy connection is
8788 available at ``request['connection']``. By default, a database connection
@@ -129,6 +130,7 @@ async def before_server_start(app_):
129130 echo = config .setdefault ('echo' , False ),
130131 min_size = config .setdefault ('pool_min_size' , 5 ),
131132 max_size = config .setdefault ('pool_max_size' , 10 ),
133+ ssl = config .setdefault ("ssl" ),
132134 loop = app_ .loop ,
133135 )
134136
Original file line number Diff line number Diff line change @@ -85,6 +85,18 @@ async def test_client_dsn():
8585 await _test_client (dict (dsn = PG_URL ))
8686
8787
88+ @pytest .fixture
89+ @async_generator
90+ async def test_client_ssl ():
91+ import ssl
92+
93+ ctx = ssl .create_default_context ()
94+ ctx .check_hostname = False
95+ ctx .verify_mode = ssl .CERT_NONE
96+
97+ await _test_client (dict (dsn = PG_URL , ssl = ctx ))
98+
99+
88100async def _test_index_returns_200 (test_client ):
89101 response = await test_client .get ('/' )
90102 assert response .status == 200
@@ -122,3 +134,7 @@ async def test(test_client):
122134
123135async def test_dsn (test_client_dsn ):
124136 await _test (test_client_dsn )
137+
138+
139+ async def test_ssl (test_client_ssl ):
140+ await _test (test_client_ssl )
You can’t perform that action at this time.
0 commit comments