-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Locate test specific helper code with tests
- Loading branch information
1 parent
bacab8a
commit 21c6e4a
Showing
7 changed files
with
109 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
TestSwiftyDropbox/TestSwiftyDropbox_iOSTests/SwiftyDropboxTestExtensions.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// TestSecureStorageAccess.swift | ||
// TestSwiftyDropbox | ||
// | ||
// Created by jlocke on 12/13/23. | ||
// Copyright © 2023 Dropbox. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import SwiftyDropbox | ||
import SwiftyDropboxObjC | ||
|
||
public extension DBXDropboxOAuthManager { | ||
@objc | ||
static func __test_only_resetForTeamSetup() { | ||
DropboxOAuthManager.sharedOAuthManager = nil | ||
} | ||
} | ||
|
||
@objc | ||
public class DBXSecureStorageAccessTestImpl: DBXSecureStorageAccessImpl { | ||
@objc | ||
public convenience init() { | ||
self.init(swift: SecureStorageAccessTestImpl()) | ||
} | ||
|
||
fileprivate init(swift: SecureStorageAccessTestImpl) { | ||
super.init(swift: swift) | ||
} | ||
} | ||
|
||
public class SecureStorageAccessTestImpl: SecureStorageAccess { | ||
private var accessTokenData: Data? | ||
|
||
public init() {} | ||
|
||
public func checkAccessibilityMigrationOneTime() {} | ||
|
||
public func setAccessTokenData(for userId: String, data: Data) -> Bool { | ||
accessTokenData = data | ||
return true | ||
} | ||
|
||
public func getAllUserIds() -> [String] { | ||
[] | ||
} | ||
|
||
public func getDropboxAccessToken(for key: String) -> DropboxAccessToken? { | ||
guard let accessTokenData = accessTokenData else { | ||
return nil | ||
} | ||
|
||
let jsonDecoder = JSONDecoder() | ||
return try? jsonDecoder.decode(DropboxAccessToken.self, from: accessTokenData) | ||
} | ||
|
||
public func deleteInfo(for key: String) -> Bool { | ||
return true | ||
} | ||
|
||
public func deleteInfoForAllKeys() -> Bool { | ||
return true | ||
} | ||
} |