Skip to content

Commit

Permalink
Cleaned up BoxCredentialMock
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Aug 20, 2024
1 parent 86d3564 commit f10e33b
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,13 @@ import Promises

class BoxCredentialMock: BoxCredential {
init() {
// Set up Box constants for testing purposes
BoxSetup.constants = BoxSetup(clientId: "", clientSecret: "", sharedContainerIdentifier: "")

// Initialize the BoxCredential with InMemoryTokenStore
let tokenStore = InMemoryTokenStorage()
super.init(tokenStorage: tokenStore)

// Override the client with a test token using BoxDeveloperTokenAuth
super.init(tokenStorage: InMemoryTokenStorage())
let devTokenAuth = BoxDeveloperTokenAuth(token: IntegrationTestSecrets.boxDeveloperToken)
client = BoxClient(auth: devTokenAuth)
}

override func deauthenticate() -> Promise<Void> {
// Set the client to an invalid token for deauthentication in tests
let invalidTokenAuth = BoxDeveloperTokenAuth(token: "invalid")
client = BoxClient(auth: invalidTokenAuth)
return Promise(())
Expand Down

0 comments on commit f10e33b

Please sign in to comment.