Skip to content

Commit

Permalink
提升单测覆盖率
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnnqin committed Mar 30, 2023
1 parent 31e7fa0 commit c17d4b4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions QCloudCSharpSDK/COSXMLTests/ServiceConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -530,5 +530,33 @@ public void ServiceSchedueTest()
Assert.Pass();

}

[Test()]
public void QCloudCredentialTest() {

string secretId = Environment.GetEnvironmentVariable("SECRET_ID");
string secretKey = Environment.GetEnvironmentVariable("SECRET_KEY");
QCloudCredentialProvider qCloudCredentialProvider;
// Invalid Param for DefaultQCloudCredential
try {
qCloudCredentialProvider = new DefaultQCloudCredentialProvider(null, null, 60);
Assert.Fail();
} catch (Exception) {}

try {
qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, null, 60);
Assert.Fail();
} catch (Exception) {}

qCloudCredentialProvider = new DefaultQCloudCredentialProvider(secretId, secretKey, 60);
qCloudCredentialProvider.Refresh();

DefaultSessionQCloudCredentialProvider defaultSessionQCloudCredentialProvider = new DefaultSessionQCloudCredentialProvider(secretId, secretKey, 60, "token");
defaultSessionQCloudCredentialProvider = new DefaultSessionQCloudCredentialProvider(secretId, secretKey, 60, 60, "token");
defaultSessionQCloudCredentialProvider.GetQCloudCredentials();
defaultSessionQCloudCredentialProvider.Refresh();
defaultSessionQCloudCredentialProvider.IsNeedUpdateNow();
defaultSessionQCloudCredentialProvider.SetQCloudCredential(secretId, secretKey, "60", "token");
}
}
}

0 comments on commit c17d4b4

Please sign in to comment.