azure-sdk-for-cpp/sdk/storage/test/common/bearer_token_test.cpp
Kan Tang b0b348e9cb
Resolved API review comments and added FileClient and DirectoryClient… (#308)
* Added API to extract raw response.

* Resolved API review comments and added FileClient and DirectoryClient for DataLake.

* Added some blob/adls Gen2 interop functionality.

* Resolved some issues/comments

* Adds more interop, support retry and concurrent upload/download.

* Added support for Azure Core's token credential to support bearer token credential.

* Added integration on RawResponse/Response<T> and resolved some test issues.

* Added validation for Client secret authentication.

* Resolved some review comments and resolved CI issue.

* Resolved a UT failure in Azure Core.

* Resolved some further comments.
2020-07-22 16:03:44 +08:00

29 lines
1.0 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
#include "blobs/blob.hpp"
#include "credentials/credentials.hpp"
#include "test_base.hpp"
namespace Azure { namespace Storage { namespace Test {
TEST(ClientSecretCredentialTest, ClientSecretCredentialWorks)
{
const std::string containerName = "bearertokentest" + LowercaseRandomString();
EXPECT_FALSE(AadClientId().empty() || AadClientSecret().empty() || AadTenantId().empty());
auto credential = std::make_shared<Azure::Core::Credentials::ClientSecretCredential>(
AadTenantId(), AadClientId(), AadClientSecret());
auto containerClient = Azure::Storage::Blobs::BlobContainerClient(
Azure::Storage::Blobs::BlobContainerClient::CreateFromConnectionString(
StandardStorageConnectionString(), containerName)
.GetUri(),
credential);
EXPECT_NO_THROW(containerClient.Create());
EXPECT_NO_THROW(containerClient.Delete());
}
}}} // namespace Azure::Storage::Test