예제 #1
0
async def test_basic_auth_password():
    config = Config()
    config.DaskGateway.authenticator_class = (
        "dask_gateway_server.auth.SimpleAuthenticator")
    config.SimpleAuthenticator.password = "******"

    async with temp_gateway(config=config) as g:
        auth = BasicAuth()
        async with g.gateway_client(auth=auth) as gateway:
            with pytest.raises(Exception):
                await gateway.list_clusters()

            auth.password = "******"

            await gateway.list_clusters()
예제 #2
0
async def test_basic_auth_password(tmpdir):
    config = Config()
    config.DaskGateway.temp_dir = str(tmpdir.join("dask-gateway"))
    config.DaskGateway.authenticator_class = (
        "dask_gateway_server.auth.DummyAuthenticator")
    config.DummyAuthenticator.password = "******"

    async with temp_gateway(config=config) as gateway_proc:
        auth = BasicAuth()

        async with Gateway(address=gateway_proc.public_url,
                           asynchronous=True,
                           auth=auth) as gateway:

            with pytest.raises(Exception):
                await gateway.list_clusters()

            auth.password = "******"

            await gateway.list_clusters()