summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorraylu <lurayl@gmail.com>2019-04-27 20:25:19 -0700
committerIrina Truong <i.chernyavska@gmail.com>2019-04-27 21:25:19 -0600
commiteef0e0d65c01159c1754e72a060a557cacdecfdb (patch)
tree1b35ceb3698176aee5aecc97be7fc9f8a0ff4bd3 /tests
parent4af4e33e31dc800a8ebaed517e0a781fa3dbb437 (diff)
Allow application_name to be overridden (#1044)
* Allow application_name to be overridden * Fixed broken link. * Default password value is empty str? * Make pep8 happier.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_main.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_main.py b/tests/test_main.py
index b1c40356..e8e801d5 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -13,6 +13,7 @@ except ImportError:
from pgcli.main import (
obfuscate_process_password, format_output, PGCli, OutputSettings, COLOR_CODE_REGEX
)
+from pgcli.pgexecute import PGExecute
from pgspecial.main import (PAGER_OFF, PAGER_LONG_OUTPUT, PAGER_ALWAYS)
from utils import dbtest, run
from collections import namedtuple
@@ -309,3 +310,12 @@ def test_multihost_db_uri(tmpdir):
user='bar',
passwd='foo',
port='2543,2543,2543')
+
+
+def test_application_name_db_uri(tmpdir):
+ with mock.patch.object(PGExecute, '__init__') as mock_pgexecute:
+ mock_pgexecute.return_value = None
+ cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile")))
+ cli.connect_uri('postgres://bar@baz.com/?application_name=cow')
+ mock_pgexecute.assert_called_with('bar', 'bar', '', 'baz.com', '', '',
+ application_name='cow')