def deploy_service_registry_and_set_urls(
    private_keys, web3, contract_manager, service_registry_address
) -> Tuple[ServiceRegistry, List[str]]:
    urls = ["http://foo", "http://boo", "http://coo"]
    c1_client = JSONRPCClient(web3, private_keys[0])
    c1_service_proxy = ServiceRegistry(
        jsonrpc_client=c1_client,
        service_registry_address=service_registry_address,
        contract_manager=contract_manager,
    )
    c2_client = JSONRPCClient(web3, private_keys[1])
    c2_service_proxy = ServiceRegistry(
        jsonrpc_client=c2_client,
        service_registry_address=service_registry_address,
        contract_manager=contract_manager,
    )
    c3_client = JSONRPCClient(web3, private_keys[2])
    c3_service_proxy = ServiceRegistry(
        jsonrpc_client=c3_client,
        service_registry_address=service_registry_address,
        contract_manager=contract_manager,
    )

    # Test that getting a random service for an empty registry returns None
    pfs_address = get_random_service(c1_service_proxy, "latest")
    assert pfs_address is None

    # Test that setting the urls works
    c1_service_proxy.set_url(urls[0])
    c2_service_proxy.set_url(urls[1])
    c3_service_proxy.set_url(urls[2])

    return c1_service_proxy, urls
def test_when_verbose_and_single_good_output_expected_data_should_be_parsed():
    expected_data = {
        "roscivs": {
            "unix username": "roscivs",
            "nt username": "bottia",
            "full name": "Roscivs Bottia",
            "user sid": "42",
            "primary group sid": "99",
            "home directory": r"\\samba\roscivs",
            "account desc": "separators! xxx so long and thanks for all the fish",
            "logoff time": "Sat, 14 Aug 2010 15:06:39 UTC",
            "kickoff time": "Sat, 14 Aug 2010 15:06:39 UTC",
            "password must change": "never",
        }
    }
    pdb_output = dedent(
        r"""
        Unix username:        roscivs
        NT username:          bottia
        User SID:             42
        Primary Group SID:    99
        Full Name:            Roscivs Bottia
        Home Directory:       \\samba\roscivs
        Account desc:         separators! xxx so long and thanks for all the fish
        Logoff time:          Sat, 14 Aug 2010 15:06:39 UTC
        Kickoff time:         Sat, 14 Aug 2010 15:06:39 UTC
        Password must change: never
        """
    ).strip()

    with patch.dict(
        pdbedit.__salt__,
        {
            "cmd.run_all": MagicMock(
                return_value={"stdout": pdb_output, "stderr": "", "retcode": 0}
            )
        },
    ):
        actual_data = pdbedit.list_users(verbose=True)
        assert actual_data == expected_data