Exemplo n.º 1
0
def test_get_client(mocker):
    mocker.patch("vault_cli.settings.build_config_from_files",
                 return_value={"url": "yay"})
    backend = mocker.Mock()

    c = client.get_client(backend=backend, yo=True)

    backend.assert_called_with(yo=True, url="yay")
    assert backend.return_value == c
Exemplo n.º 2
0
def test_get_client(mocker):
    mocker.patch("vault_cli.settings.build_config_from_files",
                 return_value={"url": "yay"})
    vault_client = mocker.patch(
        "vault_cli.client.get_client_class").return_value

    result = client.get_client(yo=True)

    vault_client.assert_called_with(yo=True, url="yay")
    assert vault_client.return_value == result
Exemplo n.º 3
0
def get_client(**additional_kwargs):
    kwargs = {
        "url": "http://vault:8000",
        "verify": True,
        "base_path": "bla",
        "login_cert": None,
        "login_cert_key": None,
        "token": "tok",
        "username": None,
        "password": None,
        "ca_bundle": None,
    }
    kwargs.update(additional_kwargs)
    return client.get_client(**kwargs)