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
adbdddbd
Commit
adbdddbd
authored
May 12, 2016
by
Dima Bart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests for nullability.
parent
8ba3ccc7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
BUYClientTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
+15
-15
BUYIntegrationTest.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
+1
-1
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYClientTest.m
View file @
adbdddbd
...
...
@@ -75,7 +75,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
{
BUYCart
*
cart
=
[
self
cart
];
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWithCart
:
cart
];
NSURLSessionDataTask
*
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}
];
XCTAssertNotNil
(
task
);
NSURLRequest
*
request
=
task
.
originalRequest
;
...
...
@@ -107,7 +107,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
XCTAssertThrows
([
checkout
setPartialAddressesValue
:
NO
]);
NSURLSessionDataTask
*
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}
];
NSDictionary
*
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
XCTAssertFalse
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
...
...
@@ -121,7 +121,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
}
checkout
.
shippingAddress
=
partialAddress
;
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
nil
];
task
=
[
self
.
client
createCheckout
:
checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}
];
json
=
[
NSJSONSerialization
JSONObjectWithData
:
task
.
originalRequest
.
HTTPBody
options
:
0
error
:
nil
];
XCTAssertTrue
([
json
[
@"checkout"
][
@"partial_addresses"
]
boolValue
]);
...
...
@@ -131,7 +131,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
{
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWithModelManager
:
self
.
client
.
modelManager
JSONDictionary
:@{
@"token"
:
@"abcdef"
,
@"payment_due"
:
@0
}];
NSURLSessionDataTask
*
task
=
[
self
.
client
completeCheckout
:
checkout
paymentToken
:
nil
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
completeCheckout
:
checkout
paymentToken
:
nil
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}
];
XCTAssertNotNil
(
task
);
}
...
...
@@ -150,7 +150,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
NSURL
*
url
=
[
NSURL
URLWithString
:
@"sampleapp://"
];
XCTAssertThrows
(
[
self
.
client
getCompletionStatusOfCheckoutURL
:
url
completion
:
nil
]
[
self
.
client
getCompletionStatusOfCheckoutURL
:
url
completion
:
^
(
BUYStatus
status
,
NSError
*
error
)
{}
]
);
}
...
...
@@ -191,12 +191,12 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
{
id
<
BUYPaymentToken
>
token
=
[[
BUYApplePayToken
alloc
]
initWithPaymentToken
:[
PKPaymentToken
new
]];
XCTAssertThrows
(
[
self
.
client
completeCheckout
:
nil
paymentToken
:
token
completion
:
nil
]
[
self
.
client
completeCheckout
:
[
BUYCheckout
new
]
paymentToken
:
token
completion
:^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}
]
);
BUYCheckout
*
checkout
=
[[
BUYCheckout
alloc
]
initWithModelManager
:
self
.
client
.
modelManager
JSONDictionary
:@{
@"token"
:
@"abcdef"
,
@"payment_due"
:
@0
}];
XCTAssertNoThrow
(
[
self
.
client
completeCheckout
:
checkout
paymentToken
:
nil
completion
:
nil
]
[
self
.
client
completeCheckout
:
checkout
paymentToken
:
nil
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{}
]
);
}
...
...
@@ -212,7 +212,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderCollectionDefault
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCollectionDefault
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -224,7 +224,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderBestSelling
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortBestSelling
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortBestSelling
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -236,7 +236,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderCreatedAscending
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedAscending
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedAscending
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -248,7 +248,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderCreatedDescending
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedDescending
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortCreatedDescending
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -260,7 +260,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderPriceAscending
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceAscending
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceAscending
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -272,7 +272,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderPriceDescending
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceDescending
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortPriceDescending
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -284,7 +284,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderTitleAscending
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleAscending
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleAscending
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
@@ -296,7 +296,7 @@ NSString * const BUYFakeCustomerToken = @"dsfasdgafdg";
-
(
void
)
testProductsInCollectionWithSortOrderTitleDescending
{
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleDescending
completion
:
nil
];
NSURLSessionDataTask
*
task
=
[
self
.
client
getProductsPage
:
1
inCollection
:
@1
sortOrder
:
BUYCollectionSortTitleDescending
completion
:
^
(
NSArray
<
BUYProduct
*>
*
products
,
NSUInteger
page
,
BOOL
reachedEnd
,
NSError
*
error
)
{}
];
XCTAssertEqualObjects
(
task
.
originalRequest
.
HTTPMethod
,
@"GET"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
scheme
,
@"https"
);
XCTAssertEqualObjects
(
task
.
originalRequest
.
URL
.
host
,
@"test_shop"
);
...
...
Mobile Buy SDK/Mobile Buy SDK Tests/BUYIntegrationTest.m
View file @
adbdddbd
...
...
@@ -909,7 +909,7 @@
return
[
OHHTTPStubsResponse
responseWithKey
:
@"testInvalidIntegrationBadShopUrl_0"
];
}];
self
.
client
=
[[
BUYClient
alloc
]
initWithShopDomain
:
@"asdfdsasdfdsasdfdsadsfowinfaoinfw.myshopify.com"
apiKey
:
self
.
apiKey
appId
:
nil
];
self
.
client
=
[[
BUYClient
alloc
]
initWithShopDomain
:
@"asdfdsasdfdsasdfdsadsfowinfaoinfw.myshopify.com"
apiKey
:
self
.
apiKey
appId
:
@"88234"
];
[
self
.
client
createCheckout
:
_checkout
completion
:
^
(
BUYCheckout
*
checkout
,
NSError
*
error
)
{
XCTAssertNotNil
(
error
);
XCTAssertEqualObjects
(
error
.
domain
,
@"shopify"
);
...
...
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