From b87ee950e3a0c43769bf29f3a98eba9887fb5564 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 18 May 2024 15:21:44 +0200 Subject: Merging upstream version 4.1.0. Signed-off-by: Daniel Baumann --- tests/test_application_name.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/test_application_name.py (limited to 'tests/test_application_name.py') diff --git a/tests/test_application_name.py b/tests/test_application_name.py new file mode 100644 index 0000000..5fac5b2 --- /dev/null +++ b/tests/test_application_name.py @@ -0,0 +1,17 @@ +from unittest.mock import patch + +from click.testing import CliRunner + +from pgcli.main import cli +from pgcli.pgexecute import PGExecute + + +def test_application_name_in_env(): + runner = CliRunner() + app_name = "wonderful_app" + with patch.object(PGExecute, "__init__") as mock_pgxecute: + runner.invoke( + cli, ["127.0.0.1:5432/hello", "user"], env={"PGAPPNAME": app_name} + ) + kwargs = mock_pgxecute.call_args.kwargs + assert kwargs.get("application_name") == app_name -- cgit v1.2.3