summaryrefslogtreecommitdiffstats
path: root/tests/test_main.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_main.py')
-rw-r--r--tests/test_main.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/tests/test_main.py b/tests/test_main.py
index fc4de7d9..b1c40356 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -267,7 +267,6 @@ def test_quoted_db_uri(tmpdir):
cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile")))
cli.connect_uri('postgres://bar%5E:%5Dfoo@baz.com/testdb%5B')
mock_connect.assert_called_with(database='testdb[',
- port=None,
host='baz.com',
user='bar^',
passwd=']foo')
@@ -281,7 +280,6 @@ def test_ssl_db_uri(tmpdir):
'sslmode=verify-full&sslcert=m%79.pem&sslkey=my-key.pem&sslrootcert=c%61.pem')
mock_connect.assert_called_with(database='testdb[',
host='baz.com',
- port=None,
user='bar^',
passwd=']foo',
sslmode='verify-full',
@@ -299,3 +297,15 @@ def test_port_db_uri(tmpdir):
user='bar',
passwd='foo',
port='2543')
+
+
+def test_multihost_db_uri(tmpdir):
+ with mock.patch.object(PGCli, 'connect') as mock_connect:
+ cli = PGCli(pgclirc_file=str(tmpdir.join("rcfile")))
+ cli.connect_uri(
+ 'postgres://bar:foo@baz1.com:2543,baz2.com:2543,baz3.com:2543/testdb')
+ mock_connect.assert_called_with(database='testdb',
+ host='baz1.com,baz2.com,baz3.com',
+ user='bar',
+ passwd='foo',
+ port='2543,2543,2543')