-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bunn/dbp/entitlement check test #2756
Conversation
self.redeemUseCase = RedeemUseCase(authenticationService: authenticationService, | ||
authenticationRepository: authenticationRepository) | ||
self.subscriptionHandler = DataBrokerProtectionSubscriptionHandler(accountManager: AccountManager(subscriptionAppGroup: Bundle.main.appGroup(bundle: .subs))) | ||
self.redeemUseCase = subscriptionHandler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The subscription handler would replace the RedeemUseCase.
This self.redeemUseCase = subscriptionHandler
is here just to validate the dependency tree, but it would be removed.
_ = ipcServiceManager | ||
} | ||
|
||
public func runOperationsAndStartSchedulerIfPossible() { | ||
testSubscription() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just test to check if the library is being accessed, obviously would be removed
} | ||
} | ||
|
||
extension AccountManager: DataBrokerProtectionAccountManaging { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea here is to have a protocol just for DBP. Basically a wrapper to help with testing
} | ||
} | ||
|
||
extension DataBrokerProtectionSubscriptionHandler: DataBrokerProtectionRedeemUseCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test code
import Subscription | ||
import Common | ||
|
||
public protocol DataBrokerProtectionAccountManaging { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AccountManaging protocol from BSK doesn't have the entitlement call which we'd need in the future. This protocol is just to bridge the gap between the AccountManaging protocol and the Actual AccountManager because I didn't want to send a concrete type to the DataBrokerProtectionSubscriptionHandler
} | ||
|
||
public func hasValidEntitlement() async -> Result<Bool, Error> { | ||
SubscriptionPurchaseEnvironment.currentServiceEnvironment = settings.selectedEnvironment == .production ? .production : .staging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SubscriptionPurchaseEnvironment is a concrete type that doesn't have a protocol in the subscription package. I might do the same wrapper here or at least inject this dependency, this is just for test, entitlement handler will not be done in this project
Task/Issue URL:
Tech Design URL:
CC:
Description:
Steps to test this PR:
1.
Internal references:
Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation