CSpell fixes for Core and Identity (#2816)
Co-authored-by: Anton Kolesnyk <antkmsft@users.noreply.github.com>
This commit is contained in:
parent
9ef8d5a45f
commit
3aee1859f0
24
.vscode/cspell.json
vendored
24
.vscode/cspell.json
vendored
@ -15,8 +15,6 @@
|
||||
"eng/common/**/*",
|
||||
"json.hpp",
|
||||
"*nlohmann-json*",
|
||||
"sdk/identity/**/*",
|
||||
"sdk/core/**/*",
|
||||
"sdk/keyvault/azure-security-keyvault-keys/test/ut/recordings/*.json",
|
||||
"sdk/keyvault/azure-security-keyvault-keys/test/ut/key_client_import_test_live.cpp"
|
||||
],
|
||||
@ -52,6 +50,7 @@
|
||||
"gtest",
|
||||
"Gzrs",
|
||||
"HKEY",
|
||||
"IMDS",
|
||||
"itfactor",
|
||||
"Kirilov",
|
||||
"lcov",
|
||||
@ -120,6 +119,27 @@
|
||||
"SECP"
|
||||
]
|
||||
},
|
||||
{
|
||||
"filename": "**/sdk/core/azure-core/README.md",
|
||||
"words": [
|
||||
"myprogram"
|
||||
]
|
||||
},
|
||||
{
|
||||
"filename": "**/sdk/core/azure-core/CHANGELOG.md",
|
||||
"words": [
|
||||
"Chisnall",
|
||||
"copiable",
|
||||
"davidchisnall",
|
||||
"Gabor",
|
||||
"Joubert",
|
||||
"juchem",
|
||||
"lordgamez",
|
||||
"sjoubert",
|
||||
"sourav",
|
||||
"Sylvain"
|
||||
]
|
||||
},
|
||||
{
|
||||
"filename": "**/sdk/storage/azure-storage-common/CHANGELOG.md",
|
||||
"words": [
|
||||
|
||||
@ -23,7 +23,7 @@ TEST(Base64, Basic)
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; },
|
||||
result,
|
||||
"AQIDBAUGBw==");
|
||||
"AQIDBAUGBw=="); // cspell:disable-line
|
||||
EXPECT_TRUE(std::equal(data.begin(), data.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
std::vector<uint8_t> subsection = std::vector<uint8_t>(data.begin(), data.begin() + 1);
|
||||
@ -43,28 +43,36 @@ TEST(Base64, Basic)
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 3);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQID");
|
||||
[](std::string expect, std::string actual) { return expect == actual; },
|
||||
result,
|
||||
"AQID"); // cspell:disable-line
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 4);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQIDBA==");
|
||||
[](std::string expect, std::string actual) { return expect == actual; },
|
||||
result,
|
||||
"AQIDBA=="); // cspell:disable-line
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 5);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQIDBAU=");
|
||||
[](std::string expect, std::string actual) { return expect == actual; },
|
||||
result,
|
||||
"AQIDBAU="); // cspell:disable-line
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
|
||||
subsection = std::vector<uint8_t>(data.begin(), data.begin() + 6);
|
||||
result = Convert::Base64Encode(subsection);
|
||||
EXPECT_PRED2(
|
||||
[](std::string expect, std::string actual) { return expect == actual; }, result, "AQIDBAUG");
|
||||
[](std::string expect, std::string actual) { return expect == actual; },
|
||||
result,
|
||||
"AQIDBAUG"); // cspell:disable-line
|
||||
EXPECT_TRUE(
|
||||
std::equal(subsection.begin(), subsection.end(), Convert::Base64Decode(result).begin()));
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ namespace Azure { namespace Core { namespace Test {
|
||||
// chunked response - simulate the data that the wire will return on every read
|
||||
std::string response0("HTTP/1.1 200 Ok\r");
|
||||
std::string response1("\ntransfer-encoding:");
|
||||
std::string response2(" chunke");
|
||||
std::string response2(" chunke"); // cspell:disable-line
|
||||
std::string response3("d\r\n");
|
||||
std::string response4("\r");
|
||||
std::string response5("\n3\r\n");
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
|
||||
using namespace Azure;
|
||||
|
||||
// cspell:words AGMT, CEST
|
||||
|
||||
TEST(DateTime, ParseDateAndTimeBasic)
|
||||
{
|
||||
auto dt1 = DateTime::Parse("20130517T00:00:00Z", DateTime::DateFormat::Rfc3339);
|
||||
@ -347,7 +349,7 @@ TEST(DateTime, ParseTimeRfc1123InvalidCases)
|
||||
"01 Jan 1971 00:00:70 GMT", // second too big
|
||||
"01 Jan 1971 00:00:61 GMT",
|
||||
"01 Jan 1969 00:00:00 CEST", // bad tz
|
||||
"14 Jan 2019 23:16:21 G0100", // bad tzoffsets
|
||||
"14 Jan 2019 23:16:21 G0100", // bad tz offsets
|
||||
//"01 Jan 1970 00:00:00 +2400",
|
||||
//"01 Jan 1970 00:00:00 -3000",
|
||||
"01 Jan 1970 00:00:00 +2160",
|
||||
@ -553,7 +555,7 @@ TEST(DateTime, ParseTimeInvalid2)
|
||||
"1971-01-01T00:00:61Z",
|
||||
"0001-01-01T00:00:00+00:01", // time zone underflow
|
||||
// "1970-01-01T00:00:00.Z", // accepted as invalid timezone above
|
||||
//"1970-01-01T00:00:00+24:00", // bad tzoffsets
|
||||
//"1970-01-01T00:00:00+24:00", // bad tz offsets
|
||||
//"1970-01-01T00:00:00-30:00",
|
||||
"1970-01-01T00:00:00+21:60",
|
||||
//"1970-01-01T00:00:00-24:00",
|
||||
|
||||
@ -7,6 +7,8 @@
|
||||
|
||||
using namespace Azure::Core::Http;
|
||||
|
||||
// cSpell:words humuhumunukunukuapuaa
|
||||
|
||||
TEST(HttpMethod, Get)
|
||||
{
|
||||
HttpMethod const get = HttpMethod::Get;
|
||||
|
||||
@ -10,6 +10,8 @@
|
||||
using Azure::Core::Diagnostics::Logger;
|
||||
using Azure::Core::Http::Policies::LogOptions;
|
||||
|
||||
// cspell:ignore qparam
|
||||
|
||||
namespace {
|
||||
void SendRequest(LogOptions const& logOptions)
|
||||
{
|
||||
|
||||
@ -29,7 +29,7 @@ class DllExportTest final {
|
||||
TEST(SimplifiedHeader, core)
|
||||
{
|
||||
EXPECT_NO_THROW(Azure::Core::CaseInsensitiveMap imap);
|
||||
EXPECT_NO_THROW(Azure::Core::CaseInsensitiveSet iset);
|
||||
EXPECT_NO_THROW(Azure::Core::CaseInsensitiveSet iset); // cspell:disable-line
|
||||
EXPECT_NO_THROW(Azure::Core::Context c);
|
||||
EXPECT_NO_THROW(Azure::DateTime(2020, 11, 03, 15, 30, 44));
|
||||
EXPECT_NO_THROW(Azure::ETag e);
|
||||
|
||||
@ -34,7 +34,7 @@ namespace Azure { namespace Service {
|
||||
// how Azure::Identity classes can be used with a generic Azure SDK service client.
|
||||
// If we have code here that gets the token, it would be up to the user to set it up to be
|
||||
// valid enough to get a token, which is not critical for the intended demonstration purposes.
|
||||
// And if user runs this, and authentication is unsuccessful, it may draw an unneccessary
|
||||
// And if user runs this, and authentication is unsuccessful, it may draw an unnecessary
|
||||
// attention to an irrelevant (to the demo) point.
|
||||
|
||||
// But an oversimplified logic of what a typical Azure SDK client does is below:
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
// These functions should be getting the real Tenant ID, Client ID, and the Client Secret to
|
||||
// authenticate. It is recommended to NOT hardcode the secret in the code, but to get it from the
|
||||
// envoronment or read it from a secure location.
|
||||
// environment or read it from a secure location.
|
||||
std::string GetTenantId() { return std::string(); }
|
||||
std::string GetClientId() { return std::string(); }
|
||||
std::string GetClientSecret() { return std::string(); }
|
||||
@ -18,7 +18,7 @@ int main()
|
||||
{
|
||||
try
|
||||
{
|
||||
// Step 1: Initialize Cient Secret Credential.
|
||||
// Step 1: Initialize Client Secret Credential.
|
||||
auto clientSecretCredential = std::make_shared<Azure::Identity::ClientSecretCredential>(
|
||||
GetTenantId(), GetClientId(), GetClientSecret());
|
||||
|
||||
|
||||
@ -42,10 +42,11 @@ TEST(ClientSecretCredential, Regular)
|
||||
"https://microsoft.com/01234567-89ab-cdef-fedc-ba8976543210/oauth2/v2.0/token");
|
||||
|
||||
{
|
||||
constexpr char expectedBody[] = "grant_type=client_credentials"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&client_secret=CLIENTSECRET"
|
||||
"&scope=https%3A%2F%2Fazure.com%2F.default";
|
||||
constexpr char expectedBody[]
|
||||
= "grant_type=client_credentials"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&client_secret=CLIENTSECRET"
|
||||
"&scope=https%3A%2F%2Fazure.com%2F.default"; // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(request.Body, expectedBody);
|
||||
|
||||
@ -88,7 +89,7 @@ TEST(ClientSecretCredential, AzureStack)
|
||||
constexpr char expectedBody[] = "grant_type=client_credentials"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&client_secret=CLIENTSECRET"
|
||||
"&scope=https%3A%2F%2Fazure.com";
|
||||
"&scope=https%3A%2F%2Fazure.com"; // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(request.Body, expectedBody);
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ CredentialTestHelper::GetTokenCallback const CredentialTestHelper::DefaultGetTok
|
||||
CredentialTestHelper::TokenRequestSimulationResult CredentialTestHelper::SimulateTokenRequest(
|
||||
CredentialTestHelper::CreateCredentialCallback const& createCredential,
|
||||
std::vector<Core::Credentials::TokenRequestContext> const& tokenRequestContexts,
|
||||
std::vector<TokenRequestSimuationServerResponse> const& responses,
|
||||
std::vector<TokenRequestSimulationServerResponse> const& responses,
|
||||
GetTokenCallback getToken)
|
||||
{
|
||||
using Azure::Core::Context;
|
||||
|
||||
@ -57,7 +57,7 @@ namespace Azure { namespace Identity { namespace Test { namespace _detail {
|
||||
std::vector<ResponseInfo> Responses;
|
||||
};
|
||||
|
||||
struct TokenRequestSimuationServerResponse
|
||||
struct TokenRequestSimulationServerResponse
|
||||
{
|
||||
Core::Http::HttpStatusCode StatusCode;
|
||||
std::string Body;
|
||||
@ -78,7 +78,7 @@ namespace Azure { namespace Identity { namespace Test { namespace _detail {
|
||||
static TokenRequestSimulationResult SimulateTokenRequest(
|
||||
CreateCredentialCallback const& createCredential,
|
||||
std::vector<Core::Credentials::TokenRequestContext> const& tokenRequestContexts,
|
||||
std::vector<TokenRequestSimuationServerResponse> const& responses,
|
||||
std::vector<TokenRequestSimulationServerResponse> const& responses,
|
||||
GetTokenCallback getToken = DefaultGetToken);
|
||||
|
||||
static TokenRequestSimulationResult SimulateTokenRequest(
|
||||
@ -88,7 +88,7 @@ namespace Azure { namespace Identity { namespace Test { namespace _detail {
|
||||
GetTokenCallback getToken = DefaultGetToken)
|
||||
{
|
||||
using Core::Http::HttpStatusCode;
|
||||
std::vector<TokenRequestSimuationServerResponse> responses;
|
||||
std::vector<TokenRequestSimulationServerResponse> responses;
|
||||
for (auto const& responseBody : responseBodies)
|
||||
{
|
||||
responses.push_back({HttpStatusCode::Ok, responseBody, {}});
|
||||
|
||||
@ -50,10 +50,11 @@ TEST(EnvironmentCredential, RegularClientSecretCredential)
|
||||
"https://microsoft.com/01234567-89ab-cdef-fedc-ba8976543210/oauth2/v2.0/token");
|
||||
|
||||
{
|
||||
constexpr char expectedBody[] = "grant_type=client_credentials"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&client_secret=CLIENTSECRET"
|
||||
"&scope=https%3A%2F%2Fazure.com%2F.default";
|
||||
constexpr char expectedBody[]
|
||||
= "grant_type=client_credentials"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&client_secret=CLIENTSECRET"
|
||||
"&scope=https%3A%2F%2Fazure.com%2F.default"; // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(request.Body, expectedBody);
|
||||
|
||||
@ -108,7 +109,7 @@ TEST(EnvironmentCredential, AzureStackClientSecretCredential)
|
||||
constexpr char expectedBody[] = "grant_type=client_credentials"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&client_secret=CLIENTSECRET"
|
||||
"&scope=https%3A%2F%2Fazure.com";
|
||||
"&scope=https%3A%2F%2Fazure.com"; // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(request.Body, expectedBody);
|
||||
|
||||
|
||||
@ -51,13 +51,13 @@ TEST(ManagedIdentityCredential, AppService)
|
||||
request0.AbsoluteUrl,
|
||||
"https://microsoft.com"
|
||||
"?api-version=2017-09-01"
|
||||
"&resource=https%3A%2F%2Fazure.com");
|
||||
"&resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request1.AbsoluteUrl,
|
||||
"https://microsoft.com"
|
||||
"?api-version=2017-09-01"
|
||||
"&resource=https%3A%2F%2Foutlook.com");
|
||||
"&resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_TRUE(request0.Body.empty());
|
||||
EXPECT_TRUE(request1.Body.empty());
|
||||
@ -119,14 +119,14 @@ TEST(ManagedIdentityCredential, AppServiceClientId)
|
||||
"https://microsoft.com"
|
||||
"?api-version=2017-09-01"
|
||||
"&clientid=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&resource=https%3A%2F%2Fazure.com");
|
||||
"&resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request1.AbsoluteUrl,
|
||||
"https://microsoft.com"
|
||||
"?api-version=2017-09-01"
|
||||
"&clientid=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&resource=https%3A%2F%2Foutlook.com");
|
||||
"&resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_TRUE(request0.Body.empty());
|
||||
EXPECT_TRUE(request1.Body.empty());
|
||||
@ -217,8 +217,8 @@ TEST(ManagedIdentityCredential, CloudShell)
|
||||
EXPECT_EQ(request0.AbsoluteUrl, "https://microsoft.com");
|
||||
EXPECT_EQ(request1.AbsoluteUrl, "https://microsoft.com");
|
||||
|
||||
EXPECT_EQ(request0.Body, "resource=https%3A%2F%2Fazure.com");
|
||||
EXPECT_EQ(request1.Body, "resource=https%3A%2F%2Foutlook.com");
|
||||
EXPECT_EQ(request0.Body, "resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
EXPECT_EQ(request1.Body, "resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
{
|
||||
EXPECT_NE(request0.Headers.find("Metadata"), request0.Headers.end());
|
||||
@ -277,11 +277,11 @@ TEST(ManagedIdentityCredential, CloudShellClientId)
|
||||
|
||||
EXPECT_EQ(
|
||||
request0.Body,
|
||||
"resource=https%3A%2F%2Fazure.com&client_id=fedcba98-7654-3210-0123-456789abcdef");
|
||||
"resource=https%3A%2F%2Fazure.com&client_id=fedcba98-7654-3210-0123-456789abcdef"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request1.Body,
|
||||
"resource=https%3A%2F%2Foutlook.com&client_id=fedcba98-7654-3210-0123-456789abcdef");
|
||||
"resource=https%3A%2F%2Foutlook.com&client_id=fedcba98-7654-3210-0123-456789abcdef"); // cspell:disable-line
|
||||
|
||||
{
|
||||
EXPECT_NE(request0.Headers.find("Metadata"), request0.Headers.end());
|
||||
@ -390,19 +390,19 @@ TEST(ManagedIdentityCredential, AzureArc)
|
||||
|
||||
EXPECT_EQ(
|
||||
request0.AbsoluteUrl,
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Fazure.com");
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request1.AbsoluteUrl,
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Fazure.com");
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request2.AbsoluteUrl,
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Foutlook.com");
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request3.AbsoluteUrl,
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Foutlook.com");
|
||||
"https://visualstudio.com?api-version=2019-11-01&resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_TRUE(request0.Body.empty());
|
||||
EXPECT_TRUE(request1.Body.empty());
|
||||
@ -640,13 +640,13 @@ TEST(ManagedIdentityCredential, Imds)
|
||||
request0.AbsoluteUrl,
|
||||
"http://169.254.169.254/metadata/identity/oauth2/token"
|
||||
"?api-version=2018-02-01"
|
||||
"&resource=https%3A%2F%2Fazure.com");
|
||||
"&resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request1.AbsoluteUrl,
|
||||
"http://169.254.169.254/metadata/identity/oauth2/token"
|
||||
"?api-version=2018-02-01"
|
||||
"&resource=https%3A%2F%2Foutlook.com");
|
||||
"&resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_TRUE(request0.Body.empty());
|
||||
EXPECT_TRUE(request1.Body.empty());
|
||||
@ -708,14 +708,14 @@ TEST(ManagedIdentityCredential, ImdsClientId)
|
||||
"http://169.254.169.254/metadata/identity/oauth2/token"
|
||||
"?api-version=2018-02-01"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&resource=https%3A%2F%2Fazure.com");
|
||||
"&resource=https%3A%2F%2Fazure.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_EQ(
|
||||
request1.AbsoluteUrl,
|
||||
"http://169.254.169.254/metadata/identity/oauth2/token"
|
||||
"?api-version=2018-02-01"
|
||||
"&client_id=fedcba98-7654-3210-0123-456789abcdef"
|
||||
"&resource=https%3A%2F%2Foutlook.com");
|
||||
"&resource=https%3A%2F%2Foutlook.com"); // cspell:disable-line
|
||||
|
||||
EXPECT_TRUE(request0.Body.empty());
|
||||
EXPECT_TRUE(request1.Body.empty());
|
||||
|
||||
Loading…
Reference in New Issue
Block a user