main
swift 36 lines 1.27 KB
Raw
1 import Foundation
2 import XCTest
3
4 import SmbCloudAuth
5
6 final class SmbCloudAuthTests: XCTestCase {
7 func testWebAuthExposesConfiguration() {
8 let webAuth = SmbCloudWebAuth(
9 environment: .production,
10 oidcClientId: "oidc-client-id",
11 redirectURL: URL(string: "myapp://auth/callback")!
12 )
13 XCTAssertEqual(webAuth.oidcClientId, "oidc-client-id")
14 XCTAssertEqual(webAuth.callbackScheme, "myapp")
15 XCTAssertEqual(webAuth.environment, .production)
16 }
17
18 func testWebAuthCallbackSchemeNilWhenMissing() {
19 let webAuth = SmbCloudWebAuth(
20 oidcClientId: "x", redirectURL: URL(string: "/no-scheme")!)
21 XCTAssertNil(webAuth.callbackScheme)
22 }
23
24 #if canImport(Security)
25 func testCredentialsManagerUsesExplicitServiceWhenProvided() {
26 let manager = SmbCloudCredentialsManager(service: "xyz.smbcloud.tests", account: "tester")
27 XCTAssertEqual(manager.service, "xyz.smbcloud.tests")
28 XCTAssertEqual(manager.account, "tester")
29 }
30
31 func testCredentialsManagerConformsToCredentialsStore() {
32 let manager: SmbCloudCredentialsStore = SmbCloudCredentialsManager(service: "xyz.smbcloud.tests")
33 XCTAssertNotNil(manager)
34 }
35 #endif
36 }