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())
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"}
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()
def entrypoint(name: str): if name == "__main__": main()