Skip to content

Commit aee0ecb

Browse files
committed
changed std to aws
1 parent afab8b6 commit aee0ecb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

tests/aws-cpp-sdk-core-tests/aws/auth/SSOCredentialTrackingTest.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class SSOCredentialsProviderTrackingTest : public Aws::Testing::AwsCppSdkGTestSu
9696
}
9797

9898
void CreateTestConfig(const Aws::String& startUrl) {
99-
std::ofstream cfg(m_configPath.c_str());
99+
Aws::OFStream cfg(m_configPath.c_str());
100100
cfg << "[default]\n"
101101
"sso_session = my-sso\n"
102102
"sso_account_id = 123456789012\n"
@@ -107,7 +107,7 @@ class SSOCredentialsProviderTrackingTest : public Aws::Testing::AwsCppSdkGTestSu
107107
"sso_start_url = " << startUrl << "\n";
108108
cfg.close();
109109

110-
std::ifstream check(m_configPath.c_str());
110+
Aws::IFStream check(m_configPath.c_str());
111111
ASSERT_TRUE(check.good()) << "Config not created at: " << m_configPath;
112112
check.close();
113113

@@ -118,7 +118,7 @@ class SSOCredentialsProviderTrackingTest : public Aws::Testing::AwsCppSdkGTestSu
118118
const Aws::String hash = computeHashedStartUrl(startUrl);
119119
const Aws::String tokenPath = m_ssoCacheDir + PATH_DELIM + hash + ".json";
120120

121-
std::ofstream tokenFile(tokenPath.c_str());
121+
Aws::OFStream tokenFile(tokenPath.c_str());
122122
ASSERT_TRUE(tokenFile.good()) << "Failed to open " << tokenPath;
123123

124124
const auto futureTime = DateTime::Now() + std::chrono::hours(1);
@@ -130,7 +130,7 @@ class SSOCredentialsProviderTrackingTest : public Aws::Testing::AwsCppSdkGTestSu
130130
"}\n";
131131
tokenFile.close();
132132

133-
std::ifstream check(tokenPath.c_str());
133+
Aws::IFStream check(tokenPath.c_str());
134134
ASSERT_TRUE(check.good()) << "Token not created at: " << tokenPath;
135135
check.close();
136136
}
@@ -140,7 +140,7 @@ class SSOCredentialsProviderTrackingTest : public Aws::Testing::AwsCppSdkGTestSu
140140
Aws::Utils::HashingUtils::CalculateSHA1(sessionName));
141141
const Aws::String tokenPath = m_ssoCacheDir + PATH_DELIM + hash + ".json";
142142

143-
std::ofstream tokenFile(tokenPath.c_str());
143+
Aws::OFStream tokenFile(tokenPath.c_str());
144144
ASSERT_TRUE(tokenFile.good()) << "Failed to open " << tokenPath;
145145

146146
const auto futureTime = Aws::Utils::DateTime::Now().Millis() + 3600000;
@@ -152,12 +152,12 @@ class SSOCredentialsProviderTrackingTest : public Aws::Testing::AwsCppSdkGTestSu
152152
"}\n";
153153
tokenFile.close();
154154

155-
std::ifstream check(tokenPath.c_str());
155+
Aws::IFStream check(tokenPath.c_str());
156156
ASSERT_TRUE(check.good()) << "Token not created at: " << tokenPath;
157157
check.close();
158158
}
159159

160-
void RunTrackingProbe(const std::shared_ptr<AWSCredentialsProvider>& provider, const Aws::String& marker) {
160+
void RunTestWithCredentialsProvider(const std::shared_ptr<AWSCredentialsProvider>& provider, const Aws::String& marker) {
161161
// 200 OK dummy response for the signed call
162162
auto req = CreateHttpRequest(URI("dummy"), HttpMethod::HTTP_POST, Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
163163
auto ok = Aws::MakeShared<StandardHttpResponse>(TEST_LOG_TAG, req);
@@ -229,14 +229,14 @@ TEST_F(SSOCredentialsProviderTrackingTest, TestSSOCredentialsTracking){
229229
EXPECT_EQ("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", creds.GetAWSSecretKey());
230230

231231
// Fire a signed request and assert the business metric appears once
232-
RunTrackingProbe(provider, "s");
232+
RunTestWithCredentialsProvider(provider, "s");
233233
}
234234

235235
TEST_F(SSOCredentialsProviderTrackingTest, TestSSOLegacyCredentialsTracking){
236236
const Aws::String startUrl = "https://test.awsapps.com/start";
237237

238238
// Create legacy SSO config (without sso_session)
239-
std::ofstream cfg(m_configPath.c_str());
239+
Aws::OFStream cfg(m_configPath.c_str());
240240
cfg << "[default]\n"
241241
"sso_account_id = 123456789012\n"
242242
"sso_region = us-east-1\n"
@@ -271,5 +271,5 @@ TEST_F(SSOCredentialsProviderTrackingTest, TestSSOLegacyCredentialsTracking){
271271
EXPECT_EQ("wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", creds.GetAWSSecretKey());
272272

273273
// Fire a signed request and assert the legacy SSO business metric appears
274-
RunTrackingProbe(provider, "u");
274+
RunTestWithCredentialsProvider(provider, "u");
275275
}

0 commit comments

Comments
 (0)