MCPcopy Create free account
hub / github.com/tortoise/tortoise-orm / test_ssl_true

Function test_ssl_true

tests/backends/test_postgres.py:79–95  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

77
78@pytest.mark.asyncio
79async def test_ssl_true():
80 db_config, is_asyncpg, is_psycopg = _get_db_config()
81 if not is_asyncpg and not is_psycopg:
82 pytest.skip("PostgreSQL only")
83
84 db_config["connections"]["models"]["credentials"]["ssl"] = True
85 ssl_failed = False
86 try:
87 await Tortoise.init(db_config, _create_db=True)
88 except (ConnectionError, ssl.SSLError):
89 ssl_failed = True
90 else:
91 assert False, "Expected ConnectionError or SSLError"
92 finally:
93 # Don't try to drop database if SSL connection failed - we can't connect
94 if Tortoise._inited and not ssl_failed:
95 await Tortoise._drop_databases()
96
97
98@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 3

_drop_databasesMethod · 0.80
_get_db_configFunction · 0.70
initMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…