Skip to content

Commit dd34b27

Browse files
committed
move a factory method to the test
1 parent bf7e6ad commit dd34b27

2 files changed

Lines changed: 32 additions & 27 deletions

File tree

Sources/SotoCore/Credential/Login/LoginCredentialsProvider.swift

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -235,33 +235,6 @@ extension LoginCredentialsProvider {
235235
httpClient: httpClient
236236
)
237237
}
238-
239-
/// Create a LoginCredentialsProvider with explicit configuration (for testing)
240-
/// - Parameters:
241-
/// - loginSession: The login session ARN
242-
/// - loginRegion: The AWS region
243-
/// - cacheDirectoryOverride: Optional override for token cache directory
244-
/// - httpClient: HTTP client for making requests
245-
/// - Returns: LoginCredentialsProvider instance
246-
internal static func create(
247-
loginSession: String,
248-
loginRegion: Region,
249-
cacheDirectoryOverride: String? = nil,
250-
httpClient: AWSHTTPClient
251-
) throws -> LoginCredentialsProvider {
252-
let endpoint = "\(loginRegion.rawValue).\(LoginConfiguration.loginServiceHostPrefix).aws.amazon.com"
253-
let configuration = LoginConfiguration(
254-
endpoint: endpoint,
255-
loginSession: loginSession,
256-
region: loginRegion,
257-
cacheDirectory: cacheDirectoryOverride
258-
)
259-
260-
return LoginCredentialsProvider(
261-
configuration: configuration,
262-
httpClient: httpClient
263-
)
264-
}
265238
}
266239

267240
// MARK: - CredentialProviderFactory Extension

Tests/SotoCoreTests/Credential/Login/LoginCredentialsProviderTests.swift

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,3 +516,35 @@ final class LoginCredentialsProviderTests {
516516
#expect(provider.description.contains("LoginCredentialsProvider"))
517517
}
518518
}
519+
520+
// MARK: - Test Helpers
521+
522+
@available(macOS 13.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)
523+
extension LoginCredentialsProvider {
524+
/// Create a LoginCredentialsProvider with explicit configuration (for testing)
525+
/// - Parameters:
526+
/// - loginSession: The login session ARN
527+
/// - loginRegion: The AWS region
528+
/// - cacheDirectoryOverride: Optional override for token cache directory
529+
/// - httpClient: HTTP client for making requests
530+
/// - Returns: LoginCredentialsProvider instance
531+
static func create(
532+
loginSession: String,
533+
loginRegion: Region,
534+
cacheDirectoryOverride: String? = nil,
535+
httpClient: AWSHTTPClient
536+
) throws -> LoginCredentialsProvider {
537+
let endpoint = "\(loginRegion.rawValue).\(LoginConfiguration.loginServiceHostPrefix).aws.amazon.com"
538+
let configuration = LoginConfiguration(
539+
endpoint: endpoint,
540+
loginSession: loginSession,
541+
region: loginRegion,
542+
cacheDirectory: cacheDirectoryOverride
543+
)
544+
545+
return LoginCredentialsProvider(
546+
configuration: configuration,
547+
httpClient: httpClient
548+
)
549+
}
550+
}

0 commit comments

Comments
 (0)