8000 Added SSL/TLS support · psqlpy-python/psqlpy@83e6f0a · GitHub
[go: up one dir, main page]

Skip to content

Commit 83e6f0a

Browse files
committed
Added SSL/TLS support
Signed-off-by: chandr-andr (Kiselev Aleksandr) <chandr@chandr.net>
1 parent 9dd7ee5 commit 83e6f0a

File tree

2 files changed

+35
-7
lines changed

2 files changed

+35
-7
lines changed

python/tests/test_ssl_mode.py

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,37 @@
11
import pytest
22

3-
from psqlpy import ConnectionPool
3+
from psqlpy import ConnectionPool, SslMode
44

55
pytestmark = pytest.mark.anyio
66

77

8-
async def test_ssl_mode_require(psql_pool_with_cert_file: ConnectionPool) -> None:
9-
await psql_pool_with_cert_file.execute("SELECT 1")
8+
@pytest.mark.parametrize(
9+
"ssl_mode",
10+
(
11+
SslMode.Allow,
12+
SslMode.Prefer,
13+
SslMode.Require,
14+
SslMode.VerifyCa,
15+
SslMode.VerifyFull,
16+
),
17+
)
18+
async def test_ssl_mode_require(
19+
ssl_mode: SslMode,
20+
postgres_host: str,
21+
postgres_user: str,
22+
postgres_password: str,
23+
postgres_port: int,
24+
postgres_dbname: str,
25+
ssl_cert_file: str,
26+
) -> None:
27+
pg_pool = ConnectionPool(
28+
username=postgres_user,
29+
password=postgres_password,
30+
host=postgres_host,
31+
port=postgres_port,
32+
db_name=postgres_dbname,
33+
ssl_mode=ssl_mode,
34+
ca_file=ssl_cert_file,
35+
)
36+
37+
await pg_pool.execute(&quo 9F98 t;SELECT 1")

tox_ssl_mode.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ env_list =
1010
[gh]
1111
python =
1212
3.12 = py312
13-
; 3.11 = py311
14-
; 3.10 = py310
15-
; 3.9 = py39
16-
; 3.8 = py38
13+
3.11 = py311
14+
3.10 = py310
15+
3.9 = py39
16+
3.8 = py38
1717

1818
[testenv]
1919
skip_install = true

0 commit comments

Comments
 (0)
0