File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ class Gino(_Gino):
82
82
* ``pool_min_size`` - the initial number of connections of the db pool.
83
83
* ``pool_max_size`` - the maximum number of connections in the db pool.
84
84
* ``echo`` - enable SQLAlchemy echo mode.
85
+ * ``ssl`` - SSL context passed to ``asyncpg.connect``, default is ``None``.
85
86
86
87
If the ``db`` is set as an aiohttp middleware, then a lazy connection is
87
88
available at ``request['connection']``. By default, a database connection
@@ -129,6 +130,7 @@ async def before_server_start(app_):
129
130
echo = config .setdefault ('echo' , False ),
130
131
min_size = config .setdefault ('pool_min_size' , 5 ),
131
132
max_size = config .setdefault ('pool_max_size' , 10 ),
133
+ ssl = config .setdefault ("ssl" ),
132
134
loop = app_ .loop ,
133
135
)
134
136
Original file line number Diff line number Diff line change @@ -85,6 +85,18 @@ async def test_client_dsn():
85
85
await _test_client (dict (dsn = PG_URL ))
86
86
87
87
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
+
88
100
async def _test_index_returns_200 (test_client ):
89
101
response = await test_client .get ('/' )
90
102
assert response .status == 200
@@ -122,3 +134,7 @@ async def test(test_client):
122
134
123
135
async def test_dsn (test_client_dsn ):
124
136
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