-
Notifications
You must be signed in to change notification settings - Fork 151
Expand file tree
/
Copy pathtable_client_test.hpp
More file actions
62 lines (53 loc) · 1.8 KB
/
table_client_test.hpp
File metadata and controls
62 lines (53 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#pragma once
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#include "test/ut/test_base.hpp"
#include <azure/data/tables/models.hpp>
#include <azure/data/tables/tables_clients.hpp>
#include <azure/data/tables/transactions.hpp>
namespace Azure { namespace Data { namespace Test {
enum class AuthType
{
Key = 0x0,
SAS = 0x1,
ConnectionString = 0x2,
};
class TablesClientTest : public Azure::Storage::Test::StorageTest,
public ::testing::WithParamInterface<AuthType> {
protected:
void SetUp() override;
void TearDown() override;
Azure::Data::Tables::TableClient CreateTableClientForTest(
Tables::TableClientOptions& clientOptions);
Azure::Data::Tables::TableClient CreateKeyTableClientForTest(
Tables::TableClientOptions& clientOptions);
std::string GetConnectionString()
{
const static std::string ConnectionString = "";
if (!ConnectionString.empty())
{
return ConnectionString;
}
const static std::string envConnectionString = GetEnv("STANDARD_STORAGE_CONNECTION_STRING");
if (!envConnectionString.empty())
{
return envConnectionString;
}
throw std::runtime_error("Cannot find connection string.");
}
std::string GetAccountName()
{
return Azure::Data::Tables::Credentials::_detail::ParseConnectionString(GetConnectionString())
.AccountName;
}
std::string GetAccountKey()
{
return Azure::Data::Tables::Credentials::_detail::ParseConnectionString(GetConnectionString())
.AccountKey;
}
protected:
std::string m_tableName;
std::shared_ptr<Tables::TableServicesClient> m_tableServiceClient;
std::shared_ptr<Tables::TableClient> m_tableClient;
};
}}} // namespace Azure::Data::Test