()
| 97 | |
| 98 | @pytest.mark.asyncio |
| 99 | async def test_ssl_custom(): |
| 100 | db_config, is_asyncpg, is_psycopg = _get_db_config() |
| 101 | if not is_asyncpg and not is_psycopg: |
| 102 | pytest.skip("PostgreSQL only") |
| 103 | |
| 104 | # Expect connectionerror or pass |
| 105 | ssl_ctx = ssl.create_default_context() |
| 106 | ssl_ctx.check_hostname = False |
| 107 | ssl_ctx.verify_mode = ssl.CERT_NONE |
| 108 | |
| 109 | db_config["connections"]["models"]["credentials"]["ssl"] = ssl_ctx |
| 110 | ssl_failed = False |
| 111 | try: |
| 112 | await Tortoise.init(db_config, _create_db=True) |
| 113 | except ConnectionError: |
| 114 | ssl_failed = True |
| 115 | finally: |
| 116 | # Don't try to drop database if SSL connection failed - we can't connect |
| 117 | if Tortoise._inited and not ssl_failed: |
| 118 | await Tortoise._drop_databases() |
| 119 | |
| 120 | |
| 121 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected
searching dependent graphs…