Esempio n. 1
0
def test_main(environ, mocker):
    mock_cli = mocker.patch("vault_cli.cli.cli")

    cli.main()

    mock_cli.assert_called_with()
    assert set({"LC_ALL": "C.UTF-8", "LANG": "C.UTF-8"}.items()) <= set(environ.items())
Esempio n. 2
0
def test_main(mocker):
    mock_cli = mocker.patch("vault_cli.cli.cli")
    environ = mocker.patch("os.environ", {})

    cli.main()

    mock_cli.assert_called_with()
    assert environ == {"LC_ALL": "C.UTF-8", "LANG": "C.UTF-8"}
Esempio n. 3
0
def test_main_askpass(environ, mocker, capsys):
    mock_cli = mocker.patch("vault_cli.cli.cli")
    environ.update({"VAULT_CLI_SSH_PASSPHRASE": "foo"})

    cli.main()

    out = capsys.readouterr().out.strip()
    assert out == "foo"

    mock_cli.assert_not_called()
Esempio n. 4
0
def entrypoint(name: str):
    if name == "__main__":
        main()