+
+
+def test_get_pg_env_add_variable(monkeypatch):
+ monkeypatch.delenv('PGPASSWORD', raising=False)
+ env = get_pg_env('user=fooF')
+
+ assert env['PGUSER'] == 'fooF'
+ assert 'PGPASSWORD' not in env
+
+
+def test_get_pg_env_overwrite_variable(monkeypatch):
+ monkeypatch.setenv('PGUSER', 'some default')
+ env = get_pg_env('user=overwriter')
+
+ assert env['PGUSER'] == 'overwriter'
+
+
+def test_get_pg_env_ignore_unknown():
+ env = get_pg_env('tty=stuff', base_env={})
+
+ assert env == {}