- Use URL.create

- Stop testing for undocumented (now unavailable) dict-style access to rows
master
Catherine Devlin 2023-02-25 23:35:44 -05:00
parent 9fbf83baff
commit f394d92981
3 changed files with 4 additions and 4 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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: