-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Derek Rada
committed
Apr 7, 2022
1 parent
2f6fe43
commit b6f792a
Showing
4 changed files
with
45 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,26 +34,28 @@ func TestDSN(t *testing.T) { | |
browserAuth bool | ||
region, | ||
role, | ||
host string | ||
host, | ||
protocol string | ||
port int | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want string | ||
wantErr bool | ||
}{ | ||
{"simple", args{"acct", "user", "pass", false, "region", "role", ""}, | ||
{"simple", args{"acct", "user", "pass", false, "region", "role", "", "https", 443}, | ||
"user:[email protected]:443?ocspFailOpen=true®ion=region&role=role&validateDefaultParameters=true", false}, | ||
{"us-west-2 special case", args{"acct2", "user2", "pass2", false, "us-west-2", "role2", ""}, | ||
{"us-west-2 special case", args{"acct2", "user2", "pass2", false, "us-west-2", "role2", "", "https", 443}, | ||
"user2:[email protected]:443?ocspFailOpen=true&role=role2&validateDefaultParameters=true", false}, | ||
{"customhostwregion", args{"acct3", "user3", "pass3", false, "", "role3", "zha123.us-east-1.privatelink.snowflakecomputing.com"}, | ||
{"customhostwregion", args{"acct3", "user3", "pass3", false, "", "role3", "zha123.us-east-1.privatelink.snowflakecomputing.com", "https", 443}, | ||
"user3:[email protected]:443?account=acct3&ocspFailOpen=true&role=role3&validateDefaultParameters=true", false}, | ||
{"customhostignoreregion", args{"acct4", "user4", "pass4", false, "fakeregion", "role4", "zha1234.us-east-1.privatelink.snowflakecomputing.com"}, | ||
"user4:[email protected]:443?account=acct4&ocspFailOpen=true&role=role4&validateDefaultParameters=true", false}, | ||
{"customhostignoreregion", args{"acct4", "user4", "pass4", false, "fakeregion", "role4", "zha1234.us-east-1.privatelink.snowflakecomputing.com", "http", 8443}, | ||
"user4:[email protected]:8443?account=acct4&ocspFailOpen=true&protocol=http&role=role4&validateDefaultParameters=true", false}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := provider.DSN(tt.args.account, tt.args.user, tt.args.password, tt.args.browserAuth, "", "", "", "", tt.args.region, tt.args.role, tt.args.host) | ||
got, err := provider.DSN(tt.args.account, tt.args.user, tt.args.password, tt.args.browserAuth, "", "", "", "", tt.args.region, tt.args.role, tt.args.host, tt.args.protocol, tt.args.port) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("DSN() error = %v, wantErr %v", err, tt.wantErr) | ||
return | ||
|
@@ -89,7 +91,7 @@ func TestOAuthDSN(t *testing.T) { | |
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := provider.DSN(tt.args.account, tt.args.user, "", false, "", "", "", tt.args.oauthAccessToken, tt.args.region, tt.args.role, "") | ||
got, err := provider.DSN(tt.args.account, tt.args.user, "", false, "", "", "", tt.args.oauthAccessToken, tt.args.region, tt.args.role, "", "https", 443) | ||
|
||
if (err != nil) != tt.wantErr { | ||
t.Errorf("DSN() error = %v, dsn = %v, wantErr %v", err, got, tt.wantErr) | ||
|