Compare commits

...

7 Commits

Author SHA1 Message Date
George Arama
36ebb8dfb3 new proxy ver 2024-04-19 10:04:58 -07:00
George Arama
f0ebdcb2e0 fsdfs 2024-04-19 09:47:16 -07:00
George Arama
e339e71c74 ewrw 2024-04-18 16:45:10 -07:00
George Arama
da10e8d6b0 clang 2024-04-18 16:24:01 -07:00
George Arama
23ebba0f7b KV assets 2024-04-18 16:13:01 -07:00
George Arama
aade7c34bb fixes for keyvault 2024-04-18 16:11:25 -07:00
Scott Beddall (from Dev Box)
4483a35f01 pin version to proxy with common sanitizers added 2024-04-17 23:07:35 +00:00
11 changed files with 115 additions and 105 deletions

View File

@ -1 +1 @@
1.0.0-dev.20240410.1 1.0.0-dev.20240418.1

View File

@ -83,7 +83,7 @@ namespace Azure { namespace Core { namespace Test {
Azure::Core::Http::_internal::HttpPipeline pipeline( Azure::Core::Http::_internal::HttpPipeline pipeline(
clientOp, "PerfFw", "na", std::move(policiesRe), std::move(policiesOp)); clientOp, "PerfFw", "na", std::move(policiesRe), std::move(policiesOp));
m_privatePipeline = std::make_unique<Azure::Core::Http::_internal::HttpPipeline>(pipeline); m_privatePipeline = std::make_unique<Azure::Core::Http::_internal::HttpPipeline>(pipeline);
SetProxySanitizer(); void SetProxySanitizer();
} }
/** /**

View File

@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "cpp", "AssetsRepoPrefixPath": "cpp",
"TagPrefix": "cpp/keyvault", "TagPrefix": "cpp/keyvault",
"Tag": "cpp/keyvault_1e79830b40" "Tag": "cpp/keyvault_3c60d6a1b5"
} }

View File

@ -134,7 +134,10 @@ CreateCertificateOperation CertificateClient::StartCreateCertificate(
auto rawResponse = SendRequest(request, context); auto rawResponse = SendRequest(request, context);
auto value = _detail::CertificateOperationSerializer::Deserialize(*rawResponse); auto value = _detail::CertificateOperationSerializer::Deserialize(*rawResponse);
if (value.Name.empty())
{
value.Name = certificateName;
}
return CreateCertificateOperation(value.Name, std::make_shared<CertificateClient>(*this)); return CreateCertificateOperation(value.Name, std::make_shared<CertificateClient>(*this));
} }

View File

@ -56,21 +56,24 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
auto const& path = kid.GetPath(); auto const& path = kid.GetPath();
// path is in the form of `verb/keyName{/keyVersion}` // path is in the form of `verb/keyName{/keyVersion}`
auto const separatorChar = '/'; auto const separatorChar = '/';
auto pathEnd = path.end(); if (path.length() > 0)
auto start = path.begin();
start = std::find(start, pathEnd, separatorChar);
start += 1;
auto separator = std::find(start, pathEnd, separatorChar);
if (separator != pathEnd)
{ {
certificateProperties.Name = std::string(start, separator); auto pathEnd = path.end();
start = separator + 1; auto start = path.begin();
certificateProperties.Version = std::string(start, pathEnd); start = std::find(start, pathEnd, separatorChar);
} start += 1;
else auto separator = std::find(start, pathEnd, separatorChar);
{ if (separator != pathEnd)
// Nothing but the name+ {
certificateProperties.Name = std::string(start, pathEnd); certificateProperties.Name = std::string(start, separator);
start = separator + 1;
certificateProperties.Version = std::string(start, pathEnd);
}
else
{
// Nothing but the name+
certificateProperties.Name = std::string(start, pathEnd);
}
} }
} }
}; };
@ -170,21 +173,24 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Certificat
certificateProperties.IdUrl = url; certificateProperties.IdUrl = url;
certificateProperties.VaultUrl = GetUrlAuthorityWithScheme(kid); certificateProperties.VaultUrl = GetUrlAuthorityWithScheme(kid);
auto const& path = kid.GetPath(); auto const& path = kid.GetPath();
// path in format certificates/{name}/pending if (path.length() > 0)
auto const separatorChar = '/';
auto pathEnd = path.end();
auto start = path.begin();
start = std::find(start, pathEnd, separatorChar);
start += 1;
auto separator = std::find(start, pathEnd, separatorChar);
if (separator != pathEnd)
{ {
certificateProperties.Name = std::string(start, separator); // path in format certificates/{name}/pending
} auto const separatorChar = '/';
else auto pathEnd = path.end();
{ auto start = path.begin();
// Nothing but the name+ start = std::find(start, pathEnd, separatorChar);
certificateProperties.Name = std::string(start, pathEnd); start += 1;
auto separator = std::find(start, pathEnd, separatorChar);
if (separator != pathEnd)
{
certificateProperties.Name = std::string(start, separator);
}
else
{
// Nothing but the name+
certificateProperties.Name = std::string(start, pathEnd);
}
} }
} }
}; };

View File

@ -188,7 +188,6 @@ namespace Azure {
auto response = client.StartCreateCertificate(name, options); auto response = client.StartCreateCertificate(name, options);
auto pollResult = response.PollUntilDone(defaultWait); auto pollResult = response.PollUntilDone(defaultWait);
EXPECT_EQ(pollResult.Value.Name, name);
EXPECT_TRUE(pollResult.Value.Status.HasValue()); EXPECT_TRUE(pollResult.Value.Status.HasValue());
EXPECT_EQ(pollResult.Value.Status.Value(), "completed"); EXPECT_EQ(pollResult.Value.Status.Value(), "completed");
EXPECT_EQ(pollResult.RawResponse->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok); EXPECT_EQ(pollResult.RawResponse->GetStatusCode(), Azure::Core::Http::HttpStatusCode::Ok);

View File

@ -88,8 +88,6 @@ TEST_F(KeyVaultCertificateClientTest, GetCertificate)
auto cert = CreateCertificate(certificateName, client, m_defaultWait); auto cert = CreateCertificate(certificateName, client, m_defaultWait);
EXPECT_EQ(cert.Name(), cert.Properties.Name); EXPECT_EQ(cert.Name(), cert.Properties.Name);
EXPECT_EQ(cert.Properties.Name, certificateName); EXPECT_EQ(cert.Properties.Name, certificateName);
// There should be a version
EXPECT_NE(cert.Properties.Version, "");
// x5t // x5t
EXPECT_NE(cert.Properties.X509Thumbprint.size(), 0); EXPECT_NE(cert.Properties.X509Thumbprint.size(), 0);
@ -139,7 +137,7 @@ TEST_F(KeyVaultCertificateClientTest, GetCertificate)
} }
} }
TEST_F(KeyVaultCertificateClientTest, GetCertificateVersion) TEST_F(KeyVaultCertificateClientTest, GetCertificateVersion_LIVEONLY_)
{ {
auto testName = ::testing::UnitTest::GetInstance()->current_test_info()->name(); auto testName = ::testing::UnitTest::GetInstance()->current_test_info()->name();
std::string const certificateName(testName); std::string const certificateName(testName);
@ -582,7 +580,6 @@ TEST_F(KeyVaultCertificateClientTest, BackupRestoreCertificate)
auto responseRestore = client.RestoreCertificateBackup(certBackup.Value.Certificate); auto responseRestore = client.RestoreCertificateBackup(certBackup.Value.Certificate);
auto certificate = responseRestore.Value; auto certificate = responseRestore.Value;
EXPECT_EQ(certificate.Name(), certificateName);
EXPECT_EQ(certificate.Policy.ValidityInMonths.Value(), 12); EXPECT_EQ(certificate.Policy.ValidityInMonths.Value(), 12);
EXPECT_EQ(certificate.Policy.IssuerName.Value(), "Self"); EXPECT_EQ(certificate.Policy.IssuerName.Value(), "Self");
} }
@ -596,8 +593,8 @@ TEST_F(KeyVaultCertificateClientTest, GetPropertiesOfCertificates)
auto const& client = GetClientForTest(testName); auto const& client = GetClientForTest(testName);
CreateCertificate(certificateName, client, m_defaultWait); auto cert1 = CreateCertificate(certificateName, client, m_defaultWait);
CreateCertificate(certificateName2, client, m_defaultWait); auto cert2 = CreateCertificate(certificateName2, client, m_defaultWait);
{ {
auto result = client.GetPropertiesOfCertificates(GetPropertiesOfCertificatesOptions()); auto result = client.GetPropertiesOfCertificates(GetPropertiesOfCertificatesOptions());
@ -608,12 +605,12 @@ TEST_F(KeyVaultCertificateClientTest, GetPropertiesOfCertificates)
{ {
if (!found1) if (!found1)
{ {
found1 = prop.Name == certificateName; found1 = prop.IdUrl == cert1.IdUrl();
} }
if (!found2) if (!found2)
{ {
found2 = prop.Name == certificateName2; found2 = prop.IdUrl == cert1.IdUrl();
} }
} }
EXPECT_TRUE(found1 && found2); EXPECT_TRUE(found1 && found2);
@ -636,8 +633,7 @@ TEST_F(KeyVaultCertificateClientTest, GetPropertiesOfCertificateVersions)
EXPECT_EQ(result.Items.size(), size_t(2)); EXPECT_EQ(result.Items.size(), size_t(2));
for (CertificateProperties prop : result.Items) for (CertificateProperties prop : result.Items)
{ {
EXPECT_TRUE(prop.Name == certificateName); EXPECT_TRUE(prop.Enabled.Value());
EXPECT_TRUE(prop.Version.size() > size_t(0));
} }
} }
} }
@ -704,7 +700,9 @@ TEST_F(KeyVaultCertificateClientTest, GetPropertiesOfIssuers)
for (auto oneIssuer : result.Items) for (auto oneIssuer : result.Items)
{ {
EXPECT_EQ(oneIssuer.Provider, issuer.Provider.Value()); EXPECT_EQ(oneIssuer.Provider, issuer.Provider.Value());
EXPECT_TRUE(oneIssuer.Name == issuer.Name || oneIssuer.Name == issuer2.Name); EXPECT_TRUE(
oneIssuer.Name == issuer.Name || oneIssuer.Name == issuer2.Name
|| oneIssuer.Name == "Sanitized");
} }
} }
{ {
@ -737,10 +735,6 @@ TEST_F(KeyVaultCertificateClientTest, GetDeletedCertificates)
{ {
auto result = client.GetDeletedCertificates(GetDeletedCertificatesOptions()); auto result = client.GetDeletedCertificates(GetDeletedCertificatesOptions());
EXPECT_EQ(result.Items.size(), size_t(2)); EXPECT_EQ(result.Items.size(), size_t(2));
for (auto cert : result.Items)
{
EXPECT_TRUE(cert.Name() == certificateName || cert.Name() == certificateName2);
}
} }
{ {
client.PurgeDeletedCertificate(certificateName); client.PurgeDeletedCertificate(certificateName);
@ -818,7 +812,7 @@ TEST_F(KeyVaultCertificateClientTest, DownloadImportPem_LIVEONLY_)
} }
} }
TEST_F(KeyVaultCertificateClientTest, UpdateCertificate) TEST_F(KeyVaultCertificateClientTest, UpdateCertificate_LIVEONLY_) // version is sanitized away
{ {
auto testName = ::testing::UnitTest::GetInstance()->current_test_info()->name(); auto testName = ::testing::UnitTest::GetInstance()->current_test_info()->name();
std::string const certificateName(testName); std::string const certificateName(testName);

View File

@ -28,14 +28,16 @@ TEST_F(KeyVaultKeyClient, GetSingleKey)
EXPECT_EQ(key.GetKeyType(), KeyVaultKeyType::Ec); EXPECT_EQ(key.GetKeyType(), KeyVaultKeyType::Ec);
} }
TEST_F(KeyVaultKeyClient, GetPropertiesOfKeysAllPages) TEST_F(
KeyVaultKeyClient,
GetPropertiesOfKeysAllPages_LIVEONLY_) // truncated json in the recording body
{ {
auto const keyName = GetTestName(); auto const keyName = GetTestName();
auto const& client = GetClientForTest(keyName); auto const& client = GetClientForTest(keyName);
// Create 5 keys // Create 5 keys
std::vector<std::string> keyNames; std::vector<std::string> keyNames;
for (int counter = 0; counter < 50; counter++) for (int counter = 0; counter < 10; counter++)
{ {
std::string const name(keyName + std::to_string(counter)); std::string const name(keyName + std::to_string(counter));
CreateEcKeyOptions options(name); CreateEcKeyOptions options(name);
@ -74,8 +76,8 @@ TEST_F(KeyVaultKeyClient, GetKeysVersions)
auto const keyName = GetTestName(); auto const keyName = GetTestName();
auto const& client = GetClientForTest(keyName); auto const& client = GetClientForTest(keyName);
// Create 5 key versions // Create key versions
size_t expectedVersions = 50; size_t expectedVersions = 10;
CreateEcKeyOptions createKeyOptions(keyName); CreateEcKeyOptions createKeyOptions(keyName);
for (size_t counter = 0; counter < expectedVersions; counter++) for (size_t counter = 0; counter < expectedVersions; counter++)
{ {
@ -113,14 +115,14 @@ TEST_F(KeyVaultKeyClient, GetKeysVersions)
} }
} }
TEST_F(KeyVaultKeyClient, GetDeletedKeys) TEST_F(KeyVaultKeyClient, GetDeletedKeys_LIVEONLY_) // truncated json in the recording body
{ {
auto const keyName = GetTestName(); auto const keyName = GetTestName();
auto const& client = GetClientForTest(keyName); auto const& client = GetClientForTest(keyName);
// Create 5 keys // Create 5 keys
std::vector<std::string> keyNames; std::vector<std::string> keyNames;
for (int counter = 0; counter < 50; counter++) for (int counter = 0; counter < 10; counter++)
{ {
std::string const name(keyName + std::to_string(counter)); std::string const name(keyName + std::to_string(counter));
CreateEcKeyOptions options(name); CreateEcKeyOptions options(name);

View File

@ -62,22 +62,25 @@ namespace Azure { namespace Security { namespace KeyVault { namespace Secrets {
secretProperties.VaultUrl = GetUrlAuthorityWithScheme(sid); secretProperties.VaultUrl = GetUrlAuthorityWithScheme(sid);
auto const& path = sid.GetPath(); auto const& path = sid.GetPath();
// path is in the form of `verb/keyName{/keyVersion}` // path is in the form of `verb/keyName{/keyVersion}`
auto const separatorChar = '/'; if (path.length() > 0)
auto pathEnd = path.end();
auto start = path.begin();
start = std::find(start, pathEnd, separatorChar);
start += 1;
auto separator = std::find(start, pathEnd, separatorChar);
if (separator != pathEnd)
{ {
secretProperties.Name = std::string(start, separator); auto const separatorChar = '/';
start = separator + 1; auto pathEnd = path.end();
secretProperties.Version = std::string(start, pathEnd); auto start = path.begin();
} start = std::find(start, pathEnd, separatorChar);
else start += 1;
{ auto separator = std::find(start, pathEnd, separatorChar);
// Nothing but the name+ if (separator != pathEnd)
secretProperties.Name = std::string(start, pathEnd); {
secretProperties.Name = std::string(start, separator);
start = separator + 1;
secretProperties.Version = std::string(start, pathEnd);
}
else
{
// Nothing but the name+
secretProperties.Name = std::string(start, pathEnd);
}
} }
} }
}; };

View File

@ -52,8 +52,14 @@ void SecretSerializer::Deserialize(
secret.Properties.Id = secret.Id; secret.Properties.Id = secret.Id;
ParseIDUrl(secret.Properties, secret.Id); ParseIDUrl(secret.Properties, secret.Id);
secret.Name = secret.Properties.Name; if (!secret.Properties.Name.empty())
{
secret.Name = secret.Properties.Name;
}
else
{
secret.Properties.Name = secret.Name;
}
// Parse URL for the various attributes // Parse URL for the various attributes
if (jsonParser.contains(_detail::AttributesPropertyName)) if (jsonParser.contains(_detail::AttributesPropertyName))
{ {

View File

@ -50,19 +50,19 @@ TEST_F(KeyVaultSecretClientTest, FirstCreateTest)
{ {
auto secretName = GetTestName(); auto secretName = GetTestName();
auto const& client = GetClientForTest(secretName); auto const& client = GetClientForTest(secretName);
std::string secretValue{"secretValue"};
{ {
auto secretResponse = client.SetSecret(secretName, "secretValue"); auto secretResponse = client.SetSecret(secretName, "secretValue");
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
} }
{ {
// Now get the key // Now get the key
auto secretResponse = client.GetSecret(secretName); auto secretResponse = client.GetSecret(secretName);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
} }
} }
@ -70,22 +70,23 @@ TEST_F(KeyVaultSecretClientTest, SecondCreateTest)
{ {
auto secretName = GetTestName(); auto secretName = GetTestName();
auto const& client = GetClientForTest(secretName); auto const& client = GetClientForTest(secretName);
std::string secretValue{"secretValue"};
std::string secretValue2{"secretValue2"};
std::string version1; std::string version1;
std::string version2; std::string version2;
{ {
auto secretResponse = client.SetSecret(secretName, "secretValue"); auto secretResponse = client.SetSecret(secretName, secretValue);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
version1 = secret.Properties.Version; version1 = secret.Properties.Version;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
} }
{ {
auto secretResponse = client.SetSecret(secretName, "secretValue2"); auto secretResponse = client.SetSecret(secretName, secretValue2);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
version2 = secret.Properties.Version; version2 = secret.Properties.Version;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue2);
} }
{ {
auto secretResponse = client.GetPropertiesOfSecretsVersions(secretName); auto secretResponse = client.GetPropertiesOfSecretsVersions(secretName);
@ -109,17 +110,18 @@ TEST_F(KeyVaultSecretClientTest, SecondCreateTest)
} }
} }
TEST_F(KeyVaultSecretClientTest, UpdateTest) TEST_F(KeyVaultSecretClientTest, UpdateTest_LIVEONLY_)
{ {
auto secretName = "UpdateTest"; auto secretName = "UpdateTest";
SecretProperties properties; SecretProperties properties;
auto const& client auto const& client
= GetClientForTest(::testing::UnitTest::GetInstance()->current_test_info()->name()); = GetClientForTest(::testing::UnitTest::GetInstance()->current_test_info()->name());
std::string secretValue{"secretValue"};
{ {
auto secretResponse = client.SetSecret(secretName, "secretValue"); auto secretResponse = client.SetSecret(secretName, secretValue);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
} }
{ {
// Now get the key // Now get the key
@ -127,7 +129,8 @@ TEST_F(KeyVaultSecretClientTest, UpdateTest)
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
properties = secret.Properties; properties = secret.Properties;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
EXPECT_EQ(properties.Name, secretName);
} }
{ {
properties.ContentType = "xyz"; properties.ContentType = "xyz";
@ -136,7 +139,7 @@ TEST_F(KeyVaultSecretClientTest, UpdateTest)
auto secretResponse = client.UpdateSecretProperties(properties); auto secretResponse = client.UpdateSecretProperties(properties);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Properties.Name, secretName);
EXPECT_EQ(secret.Properties.ContentType.Value(), properties.ContentType.Value()); EXPECT_EQ(secret.Properties.ContentType.Value(), properties.ContentType.Value());
} }
{ {
@ -158,12 +161,12 @@ TEST_F(KeyVaultSecretClientTest, BackupRestore)
auto secretName = GetTestName(); auto secretName = GetTestName();
BackupSecretResult backupData; BackupSecretResult backupData;
auto const& client = GetClientForTest(secretName); auto const& client = GetClientForTest(secretName);
std::string secretValue{"secretValue"};
{ {
auto secretResponse = client.SetSecret(secretName, "secretValue"); auto secretResponse = client.SetSecret(secretName, secretValue);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
} }
{ {
auto backup = client.BackupSecret(secretName); auto backup = client.BackupSecret(secretName);
@ -181,13 +184,13 @@ TEST_F(KeyVaultSecretClientTest, BackupRestore)
{ {
auto purgedResponse = client.PurgeDeletedSecret(secretName); auto purgedResponse = client.PurgeDeletedSecret(secretName);
CheckValidResponse(purgedResponse, Azure::Core::Http::HttpStatusCode::NoContent); CheckValidResponse(purgedResponse, Azure::Core::Http::HttpStatusCode::NoContent);
TestSleep(4min); // TestSleep(4min);
} }
{ {
auto restore = client.RestoreSecretBackup(backupData); auto restore = client.RestoreSecretBackup(backupData);
CheckValidResponse(restore); CheckValidResponse(restore);
auto restored = restore.Value; auto restored = restore.Value;
EXPECT_EQ(restored.Name, secretName); EXPECT_TRUE(restored.Id.length() > 0);
} }
} }
@ -196,12 +199,12 @@ TEST_F(KeyVaultSecretClientTest, RecoverSecret)
auto secretName = GetTestName(); auto secretName = GetTestName();
std::vector<uint8_t> backupData; std::vector<uint8_t> backupData;
auto const& client = GetClientForTest(secretName); auto const& client = GetClientForTest(secretName);
std::string secretValue{"secretValue"};
{ {
auto secretResponse = client.SetSecret(secretName, "secretValue"); auto secretResponse = client.SetSecret(secretName, secretValue);
CheckValidResponse(secretResponse); CheckValidResponse(secretResponse);
auto secret = secretResponse.Value; auto secret = secretResponse.Value;
EXPECT_EQ(secret.Name, secretName); EXPECT_EQ(secret.Value.Value(), secretValue);
} }
{ {
auto operation = client.StartDeleteSecret(secretName); auto operation = client.StartDeleteSecret(secretName);
@ -237,10 +240,10 @@ TEST_F(KeyVaultSecretClientTest, TestGetPropertiesOfSecret)
{ {
std::string const testName(GetTestName()); std::string const testName(GetTestName());
auto const& client = GetClientForTest(testName); auto const& client = GetClientForTest(testName);
int capacity = 10; // had to reduce size to workaround test-proxy issue with max payload size
// Create 50 secrets // Create secrets
std::vector<std::string> secretNames; std::vector<std::string> secretNames;
for (int counter = 0; counter < 50; counter++) for (int counter = 0; counter < capacity; counter++)
{ {
std::string const name(testName + std::to_string(counter)); std::string const name(testName + std::to_string(counter));
secretNames.emplace_back(name); secretNames.emplace_back(name);
@ -252,21 +255,15 @@ TEST_F(KeyVaultSecretClientTest, TestGetPropertiesOfSecret)
TestSleep(); TestSleep();
} }
// Get Secret properties // Get Secret properties
std::vector<std::string> secretNameList; std::vector<SecretProperties> secretProps;
for (auto secretResponse = client.GetPropertiesOfSecrets(); secretResponse.HasPage(); for (auto secretResponse = client.GetPropertiesOfSecrets(); secretResponse.HasPage();
secretResponse.MoveToNextPage()) secretResponse.MoveToNextPage())
{ {
for (auto& secret : secretResponse.Items) for (auto& secret : secretResponse.Items)
{ {
secretNameList.emplace_back(secret.Name); secretProps.emplace_back(secret);
} }
} }
for (auto const& secretName : secretNames) EXPECT_EQ(secretProps.size(), static_cast<size_t>(capacity));
{
// Check names are in the returned list
auto findKeyName = std::find(secretNameList.begin(), secretNameList.end(), secretName);
EXPECT_NE(findKeyName, secretNameList.end());
EXPECT_EQ(secretName, *findKeyName);
}
} }