diff --git a/src/sql/parse.py b/src/sql/parse.py index 0780bf0..71f3edd 100644 --- a/src/sql/parse.py +++ b/src/sql/parse.py @@ -10,7 +10,7 @@ def connection_from_dsn_section(section, config): parser = CP.ConfigParser() parser.read(config.dsn_filename) cfg_dict = dict(parser.items(section)) - return str(URL(**cfg_dict)) + return URL.create(**cfg_dict) def _connection_string(s, config): diff --git a/src/tests/test_magic.py b/src/tests/test_magic.py index 81621c8..116cd66 100644 --- a/src/tests/test_magic.py +++ b/src/tests/test_magic.py @@ -37,7 +37,7 @@ def ip(): def test_memory_db(ip): assert runsql(ip, "SELECT * FROM test;")[0][0] == 1 - assert runsql(ip, "SELECT * FROM test;")[1]["name"] == "bar" + assert runsql(ip, "SELECT * FROM test;")[1].name == "bar" def test_html(ip): diff --git a/src/tests/test_parse.py b/src/tests/test_parse.py index d6f7a5c..46d3678 100644 --- a/src/tests/test_parse.py +++ b/src/tests/test_parse.py @@ -110,9 +110,9 @@ class DummyConfig: def test_connection_from_dsn_section(): result = connection_from_dsn_section(section="DB_CONFIG_1", config=DummyConfig()) - assert result == "postgres://goesto11:seentheelephant@my.remote.host:5432/pgmain" + assert str(result) == "postgres://goesto11:***@my.remote.host:5432/pgmain" result = connection_from_dsn_section(section="DB_CONFIG_2", config=DummyConfig()) - assert result == "mysql://thefin:fishputsfishonthetable@127.0.0.1/dolfin" + assert str(result) == "mysql://thefin:***@127.0.0.1/dolfin" class Bunch: