async def test_security_dict_input():
    conf = tls_config()
    ca_file = conf["distributed"]["comm"]["tls"]["ca-file"]
    client = conf["distributed"]["comm"]["tls"]["client"]["cert"]
    worker = conf["distributed"]["comm"]["tls"]["worker"]["cert"]
    scheduler = conf["distributed"]["comm"]["tls"]["scheduler"]["cert"]

    async with Scheduler(
            host="localhost",
            dashboard_address=":0",
            security={
                "tls_ca_file": ca_file,
                "tls_scheduler_cert": scheduler
            },
    ) as s:
        assert s.address.startswith("tls://")
        async with Worker(s.address,
                          security={
                              "tls_ca_file": ca_file,
                              "tls_worker_cert": worker
                          }) as w:
            assert w.address.startswith("tls://")
            async with Client(
                    s.address,
                    security={
                        "tls_ca_file": ca_file,
                        "tls_client_cert": client
                    },
                    asynchronous=True,
            ) as c:
                result = await c.submit(inc, 1)
                assert result == 2
async def test_security_dict_input(cleanup):
    conf = tls_config()
    ca_file = conf["distributed"]["comm"]["tls"]["ca-file"]
    client = conf["distributed"]["comm"]["tls"]["client"]["cert"]
    worker = conf["distributed"]["comm"]["tls"]["worker"]["cert"]
    scheduler = conf["distributed"]["comm"]["tls"]["scheduler"]["cert"]

    async with Scheduler(security={
            "tls_ca_file": ca_file,
            "tls_scheduler_cert": scheduler
    }) as s:
        async with Worker(s.address,
                          security={
                              "tls_ca_file": ca_file,
                              "tls_worker_cert": worker
                          }) as w:
            async with Client(
                    s.address,
                    security={
                        "tls_ca_file": ca_file,
                        "tls_client_cert": client
                    },
                    asynchronous=True,
            ) as c:
                result = await c.submit(inc, 1)
                assert result == 2