Commit 52bc1d5d authored by Jose Blaya's avatar Jose Blaya
Browse files

Update mock data

parent cd492b62
......@@ -54,7 +54,7 @@ public class MockAccountProvider: AccountProvider, WebServicesConsumer {
public var mockEmail: String = "mock@email.com"
/// Fakes `AccountInfo.product_id`.
public var mockProductId: String = "com.privateinternetaccess.ios.iap.2019.1month"
public var mockProductId: String = "com.privateinternetaccess.subscription.1month"
/// Fakes `AccountInfo.plan`.
public var mockPlan: Plan = .monthly
......@@ -63,7 +63,7 @@ public class MockAccountProvider: AccountProvider, WebServicesConsumer {
public var mockIsRenewable: Bool = false
/// Fakes `AccountInfo.isRecurring`.
public var mockIsRecurring: Bool = false
public var mockIsRecurring: Bool = true
/// Fakes `AccountInfo.expirationDate`.
public var mockExpirationDate: Date = Date().addingTimeInterval(7 * 24 * 60 * 60)
......
......@@ -53,4 +53,26 @@ class AccountInfoTests: XCTestCase {
}
public func testRenewableProduct() {
let factory = MockProviders()
let expLogin = expectation(description: "login")
let credentials = Credentials(username: "p0000000", password: "foobarbogus")
Client.providers.accountProvider.login(with: LoginRequest(credentials: credentials)) { (user, error) in
guard let _ = user else {
print("Login error: \(error!)")
expLogin.fulfill()
XCTAssert(false)
return
}
XCTAssert(factory.accountProvider.isLoggedIn)
XCTAssertEqual(user?.isRenewable, false)
XCTAssertEqual(user?.info?.isRecurring, true)
expLogin.fulfill()
}
waitForExpectations(timeout: 5.0, handler: nil)
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment