mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
Add test for connecting as correct user
This commit is contained in:
parent
0e8f00e11c
commit
431b44eefe
@ -28,6 +28,11 @@ func TestConnect(t *testing.T) {
|
|||||||
t.Error("Did not connect to specified database (pgx_text)")
|
t.Error("Did not connect to specified database (pgx_text)")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rows, err = conn.Query("select current_user")
|
||||||
|
if err != nil || rows[0]["current_user"] != "pgx" {
|
||||||
|
t.Error("Did not connect as specified user (pgx)")
|
||||||
|
}
|
||||||
|
|
||||||
err = conn.Close()
|
err = conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Unable to close connection")
|
t.Fatal("Unable to close connection")
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
drop database if exists pgx_test;
|
drop database if exists pgx_test;
|
||||||
drop user if exists pgx;
|
drop user if exists pgx;
|
||||||
|
|
||||||
create user pgx password 'secret';
|
create user pgx;
|
||||||
create database pgx_test owner = pgx;
|
create database pgx_test;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user