Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
liberty
tunnel
liberty-tunnel-client-library-apple
Commits
52bc1d5d
Commit
52bc1d5d
authored
Jul 19, 2019
by
Jose Blaya
Browse files
Update mock data
parent
cd492b62
Changes
2
Hide whitespace changes
Inline
Side-by-side
PIALibrary/Sources/Mock/MockAccountProvider.swift
View file @
52bc1d5d
...
...
@@ -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
=
fals
e
public
var
mockIsRecurring
:
Bool
=
tru
e
/// Fakes `AccountInfo.expirationDate`.
public
var
mockExpirationDate
:
Date
=
Date
()
.
addingTimeInterval
(
7
*
24
*
60
*
60
)
...
...
PIALibraryTests/AccountInfoTests.swift
View file @
52bc1d5d
...
...
@@ -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
)
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment