Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
1e40d9ed
Commit
1e40d9ed
authored
Jul 19, 2019
by
Jose Blaya
Browse files
Create new class for Product plans tests
parent
792681ca
Changes
4
Hide whitespace changes
Inline
Side-by-side
PIALibrary.xcodeproj/project.pbxproj
View file @
1e40d9ed
...
...
@@ -285,6 +285,7 @@
DDD824E72189C0E800151709
/* BrandableNavigationBar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDD824E62189C0E800151709
/* BrandableNavigationBar.swift */
;
};
DDD824E82189C0EE00151709
/* BrandableNavigationBar.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDD824E62189C0E800151709
/* BrandableNavigationBar.swift */
;
};
DDD824EA2189CD5700151709
/* NavigationLogoView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDD824E92189CD5700151709
/* NavigationLogoView.swift */
;
};
DDE27E0422E1B1A700503A89
/* ProductTests.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDE27E0322E1B1A700503A89
/* ProductTests.swift */
;
};
DDFCFAA821E924A70081F235
/* TileProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDFCFAA721E924A70081F235
/* TileProvider.swift */
;
};
DDFCFAA921E924AD0081F235
/* TileProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDFCFAA721E924A70081F235
/* TileProvider.swift */
;
};
DDFCFAAB21E925160081F235
/* DefaultTileProvider.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
DDFCFAAA21E925160081F235
/* DefaultTileProvider.swift */
;
};
...
...
@@ -571,6 +572,7 @@
DDD824E4218996CD00151709
/* Pages.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Pages.swift
;
sourceTree
=
"<group>"
;
};
DDD824E62189C0E800151709
/* BrandableNavigationBar.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
BrandableNavigationBar.swift
;
sourceTree
=
"<group>"
;
};
DDD824E92189CD5700151709
/* NavigationLogoView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
NavigationLogoView.swift
;
sourceTree
=
"<group>"
;
};
DDE27E0322E1B1A700503A89
/* ProductTests.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
name
=
ProductTests.swift
;
path
=
"../../../../../../System/Volumes/Data/Users/ueshiba/Projects/PIA/client-library-apple/PIALibraryTests/ProductTests.swift"
;
sourceTree
=
"<group>"
;
};
DDFCFAA721E924A70081F235
/* TileProvider.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TileProvider.swift
;
sourceTree
=
"<group>"
;
};
DDFCFAAA21E925160081F235
/* DefaultTileProvider.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
DefaultTileProvider.swift
;
sourceTree
=
"<group>"
;
};
DDFCFAAC21E925B60081F235
/* TileableCell.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
TileableCell.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1011,6 +1013,7 @@
843C67C12122E714005A3FDA
/* AccountInfoTests.swift */
,
841BE60C212AD0F3002EF2D1
/* ValidatorTests.swift */
,
841BE611212AFFA7002EF2D1
/* GiftCardUtilTests.swift */
,
DDE27E0322E1B1A700503A89
/* ProductTests.swift */
,
0EE78B011F818A20002E4CDD
/* Info-iOS.plist */
,
0E2ADD201FE13B8600BB170C
/* Info-macOS.plist */
,
);
...
...
@@ -1864,6 +1867,7 @@
0EB8C0461F9CCB7C005857E4
/* AccountSignupTests.swift in Sources */
,
0E2ADD451FE1583A00BB170C
/* VPNTests.swift in Sources */
,
841BE612212AFFA7002EF2D1
/* GiftCardUtilTests.swift in Sources */
,
DDE27E0422E1B1A700503A89
/* ProductTests.swift in Sources */
,
);
runOnlyForDeploymentPostprocessing
=
0
;
};
...
...
PIALibraryTests/AccountTests.swift
View file @
1e40d9ed
...
...
@@ -52,28 +52,7 @@ class AccountTests: XCTestCase {
__testUpdate
(
factory
:
mock
)
__testLogout
(
factory
:
mock
)
}
func
testMockProductIdentifiers
()
{
let
expUpdate
=
expectation
(
description
:
"productIdentifiers"
)
mock
.
accountProvider
.
updatePlanProductIdentifiers
{
products
,
error
in
if
let
_
=
error
{
print
(
"error found:
\(
error
!
)
"
)
expUpdate
.
fulfill
()
XCTAssert
(
false
)
return
}
guard
let
_
=
products
else
{
print
(
"testMockProductIdentifiers:
\(
error
!
)
"
)
expUpdate
.
fulfill
()
XCTAssert
(
false
)
return
}
expUpdate
.
fulfill
()
}
waitForExpectations
(
timeout
:
5.0
,
handler
:
nil
)
}
func
testAPIEndpointIsReachable
()
{
let
expectationAPIEndpoint
=
expectation
(
description
:
"apiEndpoint"
)
...
...
PIALibraryTests/ProductTests.swift
0 → 100644
View file @
1e40d9ed
//
// ProductTests.swift
// PIALibraryTests-iOS
//
// Created by Jose Antonio Blaya Garcia on 19/07/2019.
// Copyright © 2019 London Trust Media. All rights reserved.
//
import
XCTest
@testable
import
PIALibrary
class
ProductTests
:
XCTestCase
{
private
let
mock
=
MockProviders
()
private
let
subscriptionProductIds
=
[
"com.privateinternetaccess.subscription.1month"
,
"com.privateinternetaccess.subscription.1year"
]
override
func
setUp
()
{
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override
func
tearDown
()
{
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func
testPlans
()
{
__testRetrieveSubscriptionPlans
(
webServices
:
PIAWebServices
())
}
func
testMockProductIdentifiers
()
{
let
expUpdate
=
expectation
(
description
:
"productIdentifiers"
)
mock
.
accountProvider
.
updatePlanProductIdentifiers
{
products
,
error
in
if
let
_
=
error
{
print
(
"error found:
\(
error
!
)
"
)
expUpdate
.
fulfill
()
XCTAssert
(
false
)
return
}
guard
let
_
=
products
else
{
print
(
"testMockProductIdentifiers:
\(
error
!
)
"
)
expUpdate
.
fulfill
()
XCTAssert
(
false
)
return
}
expUpdate
.
fulfill
()
}
waitForExpectations
(
timeout
:
5.0
,
handler
:
nil
)
}
private
func
__testRetrieveSubscriptionPlans
(
webServices
:
PIAWebServices
)
{
let
exp
=
expectation
(
description
:
"subscription.plans"
)
webServices
.
planProductIdentifiers
({
products
,
error
in
if
let
_
=
error
{
print
(
"Request error:
\(
error
!
)
"
)
XCTAssert
(
false
)
exp
.
fulfill
()
return
}
if
let
products
=
products
,
products
.
count
>
0
{
XCTAssertEqual
(
products
.
count
,
self
.
subscriptionProductIds
.
count
)
XCTAssertEqual
(
products
.
first
!.
identifier
,
self
.
subscriptionProductIds
.
first
!
)
XCTAssertEqual
(
products
.
last
!.
identifier
,
self
.
subscriptionProductIds
.
last
!
)
exp
.
fulfill
()
}
else
{
XCTAssert
(
error
as?
ClientError
!=
ClientError
.
malformedResponseData
,
"malformedResponseData"
)
XCTAssert
(
false
)
exp
.
fulfill
()
}
})
waitForExpectations
(
timeout
:
5.0
,
handler
:
nil
)
}
}
PIALibraryTests/ServerTests.swift
View file @
1e40d9ed
...
...
@@ -11,6 +11,7 @@ import XCTest
import
SwiftyBeaver
class
ServerTests
:
XCTestCase
{
override
func
setUp
()
{
super
.
setUp
()
...
...
@@ -48,7 +49,7 @@ class ServerTests: XCTestCase {
__testProviderDownload
(
factory
:
MockProviders
())
}
// func testWebDownload() {
// func testWebDownload() {
// __testProviderDownload(factory: Client.Providers())
// }
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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