Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shopify_iossdk
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cemarose
shopify_iossdk
Commits
8bff7c8e
Commit
8bff7c8e
authored
May 05, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust tests to comply with nullability annotations.
parent
2b75bf0d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+22
-8
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
8bff7c8e
...
...
@@ -335,7 +335,9 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
[
BUYAccountCredentialItem
itemWithPasswordConfirmation
:
@"password"
],
]];
NSURLSessionDataTask
*
task
=
[
self
.
client
createCustomerWithCredentials
:
credentials
callback
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
createCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
_Nullable
customer
,
NSString
*
_Nullable
token
,
NSError
*
_Nullable
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers.json"
);
...
...
@@ -361,7 +363,9 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
[
BUYAccountCredentialItem
itemWithEmail
:
@"fake@example.com"
],
[
BUYAccountCredentialItem
itemWithPassword
:
@"password"
],
]];
NSURLSessionDataTask
*
task
=
[
self
.
client
loginCustomerWithCredentials
:
credentials
callback
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
loginCustomerWithCredentials
:
credentials
callback
:
^
(
BUYCustomer
*
_Nullable
customer
,
NSString
*
_Nullable
token
,
NSError
*
_Nullable
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers/customer_token.json"
);
...
...
@@ -380,7 +384,9 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testGetCustomerURL
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getCustomerWithID
:
nil
callback
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getCustomerWithID
:
@""
callback
:
^
(
BUYCustomer
*
_Nullable
customer
,
NSError
*
_Nullable
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers.json"
);
...
...
@@ -391,7 +397,9 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testGetOrdersForCustomerURL
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getOrdersForCustomerWithCallback
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getOrdersForCustomerWithCallback
:
^
(
NSArray
<
BUYOrder
*>
*
_Nullable
orders
,
NSError
*
_Nullable
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers/orders.json"
);
...
...
@@ -403,7 +411,9 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testCustomerRecovery
{
NSString
*
email
=
@"fake@example.com"
;
NSURLSessionDataTask
*
task
=
[
self
.
client
recoverPasswordForCustomer
:
email
callback
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
recoverPasswordForCustomer
:
email
callback
:
^
(
BUYStatus
status
,
NSError
*
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers/recover.json"
);
...
...
@@ -421,11 +431,13 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
{
self
.
client
.
customerToken
=
nil
;
NSURLSessionDataTask
*
task
=
[
self
.
client
renewCustomerTokenWithID
:
nil
callback
:
^
(
NSString
*
token
,
NSError
*
error
)
{}];
NSURLSessionDataTask
*
task
=
[
self
.
client
renewCustomerTokenWithID
:
@""
callback
:
^
(
NSString
*
token
,
NSError
*
error
)
{}];
XCTAssertNil
(
task
);
// task should be nil if no customer token was set on the client
self
.
client
.
customerToken
=
BUYFakeCustomerToken
;
task
=
[
self
.
client
renewCustomerTokenWithID
:
@"1"
callback
:
nil
];
task
=
[
self
.
client
renewCustomerTokenWithID
:
@"1"
callback
:
^
(
NSString
*
_Nullable
token
,
NSError
*
_Nullable
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers/1/customer_token/renew.json"
);
...
...
@@ -441,7 +453,9 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
]];
NSString
*
customerID
=
@"12345"
;
NSString
*
customerToken
=
@"12345"
;
NSURLSessionDataTask
*
task
=
[
self
.
client
activateCustomerWithCredentials
:
credentials
customerID
:
customerID
customerToken
:
customerToken
callback
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
activateCustomerWithCredentials
:
credentials
customerID
:
customerID
customerToken
:
customerToken
callback
:^
(
BUYCustomer
*
_Nullable
customer
,
NSString
*
_Nullable
token
,
NSError
*
_Nullable
error
)
{
}];
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
path
,
@"/api/customers/12345/activate.json"
);
...
...
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