Skip to content

Commit 706adfe

Browse files
NOSNOW: Fix dotnet formatting (#1175)
1 parent b0fd5cb commit 706adfe

File tree

186 files changed

+1037
-995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+1037
-995
lines changed

Snowflake.Data.Tests/AuthenticationTests/AuthConnectionString.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,13 +189,13 @@ public static string GetOauthToken()
189189
try
190190
{
191191
using (var client = new HttpClient(new HttpClientHandler
192-
{
193-
CheckCertificateRevocationList = true,
194-
SslProtocols = SslProtocols.Tls12,
195-
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
196-
UseProxy = false,
197-
UseCookies = false
198-
}))
192+
{
193+
CheckCertificateRevocationList = true,
194+
SslProtocols = SslProtocols.Tls12,
195+
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate,
196+
UseProxy = false,
197+
UseCookies = false
198+
}))
199199
{
200200
var authUrl = Environment.GetEnvironmentVariable("SNOWFLAKE_AUTH_TEST_OAUTH_URL");
201201
var clientId = Environment.GetEnvironmentVariable("SNOWFLAKE_AUTH_TEST_OAUTH_CLIENT_ID");

Snowflake.Data.Tests/AuthenticationTests/AuthTestHelper.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ public Thread GetProvideCredentialsThread(string scenario, string login, string
102102
return new Thread(() => ProvideCredentials(scenario, login, password));
103103
}
104104

105-
public void VerifyExceptionIsNotThrown() {
105+
public void VerifyExceptionIsNotThrown()
106+
{
106107
Assert.That(_exception, Is.Null, "Unexpected exception thrown");
107108
}
108109

109-
public void VerifyExceptionIsThrown(string error) {
110+
public void VerifyExceptionIsThrown(string error)
111+
{
110112
Assert.That(_exception, Is.Not.Null, "Expected exception was not thrown");
111113
Assert.That(_exception.Message, Does.Contain(error), "Unexpected exception message.");
112114

@@ -142,7 +144,7 @@ private void StartNodeProcess(string path, TimeSpan timeout)
142144
using (var process = new Process { StartInfo = startInfo })
143145
{
144146
process.Start();
145-
if (!process.WaitForExit((int) timeout.TotalMilliseconds))
147+
if (!process.WaitForExit((int)timeout.TotalMilliseconds))
146148
{
147149
process.Kill();
148150
throw new TimeoutException("The process did not complete in the allotted time.");

Snowflake.Data.Tests/AuthenticationTests/ExternalBrowserConnectionTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void TestAuthenticateUsingExternalBrowserWrongCredentials()
7070

7171
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
7272
authTestHelper.VerifyExceptionIsThrown("Browser response timed out after 15 seconds");
73-
}
73+
}
7474

7575
[Test, IgnoreOnCI]
7676
public void TestAuthenticateUsingExternalBrowserTimeout()
@@ -87,5 +87,5 @@ public void TestAuthenticateUsingExternalBrowserTimeout()
8787
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
8888
authTestHelper.VerifyExceptionIsThrown("Browser response timed out after 1 seconds");
8989
}
90-
}
90+
}
9191
}

Snowflake.Data.Tests/AuthenticationTests/KeyPairConnectionTest.cs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,42 +22,42 @@ public void TestAuthenticateUsingKeyPairFileContentSuccessful()
2222
authTestHelper.VerifyExceptionIsNotThrown();
2323
}
2424

25-
[Test, IgnoreOnCI]
26-
public void TestAuthenticateUsingKeyPairFileContentInvalidKey()
27-
{
28-
AuthTestHelper authTestHelper = new AuthTestHelper();
29-
30-
var privateKey = AuthConnectionString.GetPrivateKeyContentForKeypairAuth("SNOWFLAKE_AUTH_TEST_INVALID_PRIVATE_KEY_PATH");
31-
var parameters = AuthConnectionString.GetKeyPairFromFileContentParameters(privateKey);
32-
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
33-
34-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
35-
authTestHelper.VerifyExceptionIsThrown("Error: JWT token is invalid");
36-
}
37-
38-
[Test, IgnoreOnCI]
39-
public void TestAuthenticateUsingKeyPairFilePathSuccessful()
40-
{
41-
AuthTestHelper authTestHelper = new AuthTestHelper();
42-
var privateKeyPath = AuthConnectionString.GetPrivateKeyPathForKeypairAuth("SNOWFLAKE_AUTH_TEST_PRIVATE_KEY_PATH");
43-
var parameters = AuthConnectionString.GetKeyPairFromFilePathConnectionString(privateKeyPath);
44-
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
45-
46-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
47-
authTestHelper.VerifyExceptionIsNotThrown();
48-
}
49-
50-
[Test, IgnoreOnCI]
51-
public void TestAuthenticateUsingKeyPairFilePathInvalidKey()
52-
{
53-
AuthTestHelper authTestHelper = new AuthTestHelper();
54-
55-
var privateKeyPath = AuthConnectionString.GetPrivateKeyPathForKeypairAuth("SNOWFLAKE_AUTH_TEST_INVALID_PRIVATE_KEY_PATH");
56-
var parameters = AuthConnectionString.GetKeyPairFromFilePathConnectionString(privateKeyPath);
57-
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
58-
59-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
60-
authTestHelper.VerifyExceptionIsThrown("Error: JWT token is invalid");
61-
}
62-
}
25+
[Test, IgnoreOnCI]
26+
public void TestAuthenticateUsingKeyPairFileContentInvalidKey()
27+
{
28+
AuthTestHelper authTestHelper = new AuthTestHelper();
29+
30+
var privateKey = AuthConnectionString.GetPrivateKeyContentForKeypairAuth("SNOWFLAKE_AUTH_TEST_INVALID_PRIVATE_KEY_PATH");
31+
var parameters = AuthConnectionString.GetKeyPairFromFileContentParameters(privateKey);
32+
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
33+
34+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
35+
authTestHelper.VerifyExceptionIsThrown("Error: JWT token is invalid");
36+
}
37+
38+
[Test, IgnoreOnCI]
39+
public void TestAuthenticateUsingKeyPairFilePathSuccessful()
40+
{
41+
AuthTestHelper authTestHelper = new AuthTestHelper();
42+
var privateKeyPath = AuthConnectionString.GetPrivateKeyPathForKeypairAuth("SNOWFLAKE_AUTH_TEST_PRIVATE_KEY_PATH");
43+
var parameters = AuthConnectionString.GetKeyPairFromFilePathConnectionString(privateKeyPath);
44+
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
45+
46+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
47+
authTestHelper.VerifyExceptionIsNotThrown();
48+
}
49+
50+
[Test, IgnoreOnCI]
51+
public void TestAuthenticateUsingKeyPairFilePathInvalidKey()
52+
{
53+
AuthTestHelper authTestHelper = new AuthTestHelper();
54+
55+
var privateKeyPath = AuthConnectionString.GetPrivateKeyPathForKeypairAuth("SNOWFLAKE_AUTH_TEST_INVALID_PRIVATE_KEY_PATH");
56+
var parameters = AuthConnectionString.GetKeyPairFromFilePathConnectionString(privateKeyPath);
57+
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
58+
59+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
60+
authTestHelper.VerifyExceptionIsThrown("Error: JWT token is invalid");
61+
}
62+
}
6363
}

Snowflake.Data.Tests/AuthenticationTests/OauthConnectionTest.cs

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,41 @@ public void SetUp()
1818
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
1919
}
2020

21-
[Test, IgnoreOnCI]
22-
public void TestAuthenticateUsingOauthSuccessful()
23-
{
24-
AuthTestHelper authTestHelper = new AuthTestHelper();
25-
26-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
27-
authTestHelper.VerifyExceptionIsNotThrown();
28-
}
29-
30-
[Test, IgnoreOnCI]
31-
public void TestAuthenticateUsingOauthInvalidToken()
32-
{
33-
AuthTestHelper authTestHelper = new AuthTestHelper();
34-
35-
string token = "invalidToken";
36-
var parameters = AuthConnectionString.GetOauthConnectionString(token);
37-
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
38-
39-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
40-
authTestHelper.VerifyExceptionIsThrown("Invalid OAuth access token");
41-
}
42-
43-
[Test, Ignore("Skipped, waits for SNOW-1893041")]
44-
public void TestAuthenticateUsingOauthMismatchedUser()
45-
{
46-
AuthTestHelper authTestHelper = new AuthTestHelper();
47-
48-
string token = AuthConnectionString.GetOauthToken();
49-
var parameters = AuthConnectionString.GetOauthConnectionString(token);
50-
parameters[SFSessionProperty.USER] = "fakeAccount";
51-
parameters.Add(SFSessionProperty.POOLINGENABLED, "false");
52-
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
53-
54-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
55-
authTestHelper.VerifyExceptionIsThrown("The user you were trying to authenticate as differs from the user tied to the access token");
56-
}
21+
[Test, IgnoreOnCI]
22+
public void TestAuthenticateUsingOauthSuccessful()
23+
{
24+
AuthTestHelper authTestHelper = new AuthTestHelper();
25+
26+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
27+
authTestHelper.VerifyExceptionIsNotThrown();
28+
}
29+
30+
[Test, IgnoreOnCI]
31+
public void TestAuthenticateUsingOauthInvalidToken()
32+
{
33+
AuthTestHelper authTestHelper = new AuthTestHelper();
34+
35+
string token = "invalidToken";
36+
var parameters = AuthConnectionString.GetOauthConnectionString(token);
37+
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
38+
39+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
40+
authTestHelper.VerifyExceptionIsThrown("Invalid OAuth access token");
41+
}
42+
43+
[Test, Ignore("Skipped, waits for SNOW-1893041")]
44+
public void TestAuthenticateUsingOauthMismatchedUser()
45+
{
46+
AuthTestHelper authTestHelper = new AuthTestHelper();
47+
48+
string token = AuthConnectionString.GetOauthToken();
49+
var parameters = AuthConnectionString.GetOauthConnectionString(token);
50+
parameters[SFSessionProperty.USER] = "fakeAccount";
51+
parameters.Add(SFSessionProperty.POOLINGENABLED, "false");
52+
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
53+
54+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
55+
authTestHelper.VerifyExceptionIsThrown("The user you were trying to authenticate as differs from the user tied to the access token");
56+
}
5757
}
5858
}

Snowflake.Data.Tests/AuthenticationTests/OktaAuthorizationCodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public void TestAuthenticateOktaAuthorizationCodeWrongCredentials()
7171

7272
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
7373
authTestHelper.VerifyExceptionIsThrown("Browser response timed out after 15 seconds");
74-
}
74+
}
7575

7676
[Test, IgnoreOnCI]
7777
public void TestAuthenticateOktaAuthorizationCodeTimeout()

Snowflake.Data.Tests/AuthenticationTests/SnowflakeAuthorizationCodeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void TestAuthenticateSnowflakeAuthorizationCodeWrongCredentials()
7373

7474
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
7575
authTestHelper.VerifyExceptionIsThrown("Browser response timed out after 15 seconds");
76-
}
76+
}
7777

7878
[Test, IgnoreOnCI]
7979
public void TestAuthenticateSnowflakeAuthorizationCodeTimeout()

Snowflake.Data.Tests/AuthenticationTests/SnowflakeAuthorizationCodeWilidcardsTest.cs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public void TestAuthenticateSnowflakeAuthorizationCodeWilidcardsWrongCredentials
7272

7373
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
7474
authTestHelper.VerifyExceptionIsThrown("Browser response timed out after 30 seconds");
75-
}
75+
}
7676

7777
[Test, IgnoreOnCI]
7878
public void TestAuthenticateSnowflakeAuthorizationCodeWilidcardsTimeout()
@@ -87,35 +87,35 @@ public void TestAuthenticateSnowflakeAuthorizationCodeWilidcardsTimeout()
8787
authTestHelper.VerifyExceptionIsThrown("Browser response timed out after 1 seconds");
8888
}
8989

90-
[Test, IgnoreOnCI]
91-
public void TestAuthenticateSnowflakeAuthorizationCodeWildcardsWithTokenCache()
92-
{
93-
AuthTestHelper authTestHelper = new AuthTestHelper();
94-
95-
var parameters = AuthConnectionString.GetOAuthSnowflakeAuthorizationCodeWilidcardsConnectionParameters();
96-
parameters.Add(SFSessionProperty.BROWSER_RESPONSE_TIMEOUT, "10");
97-
parameters.Add(SFSessionProperty.POOLINGENABLED, "false");
98-
parameters[SFSessionProperty.CLIENT_STORE_TEMPORARY_CREDENTIAL] = "true";
99-
var host = parameters[SFSessionProperty.HOST];
100-
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
101-
102-
Thread connectThread = authTestHelper.GetConnectAndExecuteSimpleQueryThread(_connectionString);
103-
Thread provideCredentialsThread = authTestHelper.GetProvideCredentialsThread("internalOauthSnowflakeSuccess", _login, _password);
104-
try
105-
{
106-
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
107-
authTestHelper.VerifyExceptionIsNotThrown();
108-
109-
authTestHelper.CleanBrowserProcess();
110-
111-
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
112-
authTestHelper.VerifyExceptionIsNotThrown();
113-
}
114-
finally
115-
{
116-
authTestHelper.RemoveTokenFromCache(host, _login, TokenType.OAuthAccessToken);
117-
authTestHelper.RemoveTokenFromCache(host, _login, TokenType.OAuthRefreshToken);
118-
}
119-
}
90+
[Test, IgnoreOnCI]
91+
public void TestAuthenticateSnowflakeAuthorizationCodeWildcardsWithTokenCache()
92+
{
93+
AuthTestHelper authTestHelper = new AuthTestHelper();
94+
95+
var parameters = AuthConnectionString.GetOAuthSnowflakeAuthorizationCodeWilidcardsConnectionParameters();
96+
parameters.Add(SFSessionProperty.BROWSER_RESPONSE_TIMEOUT, "10");
97+
parameters.Add(SFSessionProperty.POOLINGENABLED, "false");
98+
parameters[SFSessionProperty.CLIENT_STORE_TEMPORARY_CREDENTIAL] = "true";
99+
var host = parameters[SFSessionProperty.HOST];
100+
_connectionString = AuthConnectionString.ConvertToConnectionString(parameters);
101+
102+
Thread connectThread = authTestHelper.GetConnectAndExecuteSimpleQueryThread(_connectionString);
103+
Thread provideCredentialsThread = authTestHelper.GetProvideCredentialsThread("internalOauthSnowflakeSuccess", _login, _password);
104+
try
105+
{
106+
authTestHelper.ConnectAndProvideCredentials(provideCredentialsThread, connectThread);
107+
authTestHelper.VerifyExceptionIsNotThrown();
108+
109+
authTestHelper.CleanBrowserProcess();
110+
111+
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString);
112+
authTestHelper.VerifyExceptionIsNotThrown();
113+
}
114+
finally
115+
{
116+
authTestHelper.RemoveTokenFromCache(host, _login, TokenType.OAuthAccessToken);
117+
authTestHelper.RemoveTokenFromCache(host, _login, TokenType.OAuthRefreshToken);
118+
}
119+
}
120120
}
121121
}

0 commit comments

Comments
 (0)