]> git.ipfire.org Git - thirdparty/psycopg.git/commitdiff
Don't assume that the user "postgres" always exists in tests
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>
Mon, 28 Jun 2021 14:07:14 +0000 (15:07 +0100)
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>
Tue, 29 Jun 2021 00:23:41 +0000 (01:23 +0100)
tests/types/test_array.py

index 90cf1bd1e80790ca8bb14f622ccc175604c3ff1d..b04b752378ce535037aa19aa1709d6823078f72d 100644 (file)
@@ -128,10 +128,10 @@ def test_array_register(conn):
 
 
 def test_array_of_unknown_builtin(conn):
+    user = conn.execute("select user").fetchone()[0]
     # we cannot load this type, but we understand it is an array
-    val = "postgres=arwdDxt/postgres"
-    cur = conn.cursor()
-    cur.execute(f"select '{val}'::aclitem, array['{val}']::aclitem[]")
+    val = f"{user}=arwdDxt/{user}"
+    cur = conn.execute(f"select '{val}'::aclitem, array['{val}']::aclitem[]")
     res = cur.fetchone()
     assert cur.description[0].type_code == builtins["aclitem"].oid
     assert res[0] == val