async def test_connection_notebook_wrong_certs(app):
    """Connecting to a notebook fails without correct certs"""
    with mock.patch.dict(
        app.config.LocalProcessSpawner,
        {'cmd': [sys.executable, '-m', 'jupyterhub.tests.mocksu']},
    ):
        user = add_user(app.db, app, name='foo')
        await user.spawn()
        await wait_for_spawner(user.spawner)
        spawner = user.spawner
        status = await spawner.poll()
        assert status is None

        with pytest.raises(SSL_ERROR):
            kwargs = {'verify': False}
            r = await async_requests.get(spawner.server.url, **kwargs)
            r.raise_for_status()
Connecting to a notebook fails without correct certs
jupyterhub/tests/test_internal_ssl_connections.py