(t *testing.T)
| 281 | } |
| 282 | |
| 283 | func TestConnectOAuthError(t *testing.T) { |
| 284 | if os.Getenv(runOAuthTestEnvVar) != "true" { |
| 285 | t.Skipf("Skipping as '%s=true' is not set", runOAuthTestEnvVar) |
| 286 | } |
| 287 | |
| 288 | config, err := pgconn.ParseConfig("host=127.0.0.1 user=pgx_oauth dbname=pgx_test") |
| 289 | require.NoError(t, err) |
| 290 | |
| 291 | // Configure OAuthTokenProvider for dummy validator. |
| 292 | // The dummy validator accepts any token and maps it to the user equal to the |
| 293 | // token string. In this case that token will be accepted but as there is no |
| 294 | // user 'INVALID_TOKEN' the connection should fail. |
| 295 | config.OAuthTokenProvider = func(ctx context.Context) (string, error) { |
| 296 | return "INVALID_TOKEN", nil |
| 297 | } |
| 298 | |
| 299 | _, err = pgconn.ConnectConfig(context.Background(), config) |
| 300 | require.Error(t, err, "connect should return error for invalid token") |
| 301 | } |
| 302 | |
| 303 | func TestConnectTLSPasswordProtectedClientCertWithSSLPassword(t *testing.T) { |
| 304 | t.Parallel() |
nothing calls this directly
no test coverage detected