MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / test_ssl_fallback_error_cause

Method test_ssl_fallback_error_cause

tests/test_connect.py:2255–2267  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2253 self.assertEqual(seen, [mode == 'prefer'])
2254
2255 async def test_ssl_fallback_error_cause(self):
2256 for mode in ('allow', 'prefer'):
2257 faults = (
2258 {'error': asyncpg.InvalidCatalogNameError},
2259 {'error': asyncpg.TooManyConnectionsError},
2260 )
2261 async with self.connection_proxy(*faults) as (port, seen):
2262 with self.assertRaises(asyncpg.TooManyConnectionsError) as exc:
2263 await self.connect(host='127.0.0.1', port=port,
2264 user='ssl_user', ssl=mode)
2265 self.assertIsInstance(exc.exception.__cause__,
2266 asyncpg.InvalidCatalogNameError)
2267 self.assertEqual(seen, [mode == 'prefer', mode == 'allow'])
2268
2269 async def test_ssl_cannot_connect_now_failover(self):
2270 self._allow_plaintext()

Callers

nothing calls this directly

Calls 2

connection_proxyMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected