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
c45ff37d
Commit
c45ff37d
authored
May 09, 2016
by
Brent Gulanowski
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'integration/sdk-2.0' into task/generated-models
parents
196c642d
b250d1ef
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
209 additions
and
23 deletions
+209
-23
BUYErrorTests.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYErrorTests.m
+63
-0
BUYOptionValueTests.m
Mobile Buy SDK/Mobile Buy SDK Tests/BUYOptionValueTests.m
+93
-0
test_shop_data.json
Mobile Buy SDK/Mobile Buy SDK Tests/test_shop_data.json
+35
-21
project.pbxproj
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
+17
-0
BUYClient+Customers.m
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
+1
-1
BUYCustomer.m
...le Buy SDK/Mobile Buy SDK/Models/Persistent/BUYCustomer.m
+0
-1
No files found.
Mobile Buy SDK/Mobile Buy SDK Tests/BUYErrorTests.m
0 → 100644
View file @
c45ff37d
//
// BUYErrorTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "BUYError.h"
@interface
BUYErrorTests
:
XCTestCase
@end
@implementation
BUYErrorTests
-
(
void
)
testInitWithValidData
{
NSDictionary
*
options
=
@{
@"option1"
:
@432
,
@"option2"
:
@"string"
,
};
NSDictionary
*
json
=
@{
@"code"
:
@123
,
@"message"
:
@"someError"
,
@"options"
:
options
,
};
BUYError
*
error
=
[[
BUYError
alloc
]
initWithKey
:
@"testKey"
json
:
json
];
XCTAssertNotNil
(
error
);
XCTAssertEqualObjects
(
error
.
key
,
@"testKey"
);
XCTAssertEqualObjects
(
error
.
code
,
json
[
@"code"
]);
XCTAssertEqualObjects
(
error
.
message
,
json
[
@"message"
]);
XCTAssertEqualObjects
(
error
.
options
,
json
[
@"options"
]);
}
-
(
void
)
testDescription
{
BUYError
*
error
=
[[
BUYError
alloc
]
initWithKey
:
@"testKey"
json
:@{
@"message"
:
@"some-message"
}];
XCTAssertEqualObjects
(
error
.
description
,
@"testKey some-message"
);
}
@end
Mobile Buy SDK/Mobile Buy SDK Tests/BUYOptionValueTests.m
0 → 100644
View file @
c45ff37d
//
// BUYOptionValueTests.m
// Mobile Buy SDK
//
// Created by Shopify.
// Copyright (c) 2015 Shopify Inc. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <XCTest/XCTest.h>
#import "BUYOptionValue.h"
@interface
BUYOptionValueTests
:
XCTestCase
@end
@implementation
BUYOptionValueTests
{
BUYModelManager
*
_modelManager
;
}
-
(
instancetype
)
initWithInvocation
:
(
NSInvocation
*
)
invocation
{
self
=
[
super
initWithInvocation
:
invocation
];
if
(
self
)
{
_modelManager
=
[
BUYModelManager
modelManager
];
}
return
self
;
}
-
(
void
)
testInitWithValidData
{
NSDictionary
*
json
=
[
self
jsonWithOptionID
:
@749
];
BUYOptionValue
*
value
=
[
self
optionValueWithOptionID
:
@749
];
XCTAssertNotNil
(
value
);
XCTAssertEqualObjects
(
value
.
name
,
json
[
@"name"
]);
XCTAssertEqualObjects
(
value
.
value
,
json
[
@"value"
]);
XCTAssertEqualObjects
(
value
.
optionId
,
json
[
@"option_id"
]);
}
-
(
void
)
testEqualOptions
{
BUYOptionValue
*
value1
=
[
self
optionValueWithOptionID
:
@321
];
BUYOptionValue
*
value2
=
[
self
optionValueWithOptionID
:
@321
];
XCTAssertNotEqual
(
value1
,
value2
);
// Pointer comparison, different objects
XCTAssertEqualObjects
(
value1
,
value2
);
XCTAssertEqual
(
value1
.
hash
,
value2
.
hash
);
}
-
(
void
)
testIdenticalOptions
{
BUYOptionValue
*
value1
=
[
self
optionValueWithOptionID
:
@321
];
BUYOptionValue
*
value2
=
value1
;
XCTAssertEqual
(
value1
,
value2
);
XCTAssertTrue
([
value1
isEqual
:
value2
]);
}
#pragma mark - Convenience -
-
(
BUYOptionValue
*
)
optionValueWithOptionID
:
(
NSNumber
*
)
optionID
{
return
[
_modelManager
buy_objectWithEntityName
:[
BUYOptionValue
entityName
]
JSONDictionary
:[
self
jsonWithOptionID
:
optionID
]];
}
-
(
NSDictionary
*
)
jsonWithOptionID
:
(
NSNumber
*
)
optionID
{
return
@{
@"name"
:
@"option1"
,
@"value"
:
@"value1"
,
@"option_id"
:
@543
,
};
}
@end
Mobile Buy SDK/Mobile Buy SDK Tests/test_shop_data.json
View file @
c45ff37d
{
"application_name"
:
"MobileBuyTest"
,
<<<<<<<
Updated
upstream
"shop_domain"
:
""
,
"api_key"
:
""
,
"channel_id"
:
""
,
...
...
@@ -7,51 +8,64 @@
"merchant_id"
:
""
,
"customer_email"
:
""
,
"customer_password"
:
""
,
=======
"shop_domain"
:
"mobilebuysdktestshop.myshopify.com"
,
"api_key"
:
"fccaa7eceb7d210a6e5366e676d4edff"
,
"channel_id"
:
"26915715"
,
"app_id"
:
"8"
,
"merchant_id"
:
"merchant.com.shopify.applepay"
,
>>>>>>>
Stashed
changes
"product_ids"
:
[
""
,
""
"2096060931"
,
"2096063363"
,
"2096062275"
,
"2096057987"
],
<<<<<<<
Updated
upstream
"variants"
:
{
"variant_untracked_id"
:
""
,
"variant_inventory1_id"
:
""
,
"variant_soldout_id"
:
""
},
"collection_id"
:
""
,
=======
"collection_id"
:
"109931075"
,
>>>>>>>
Stashed
changes
"gift_cards"
:
{
"
ValidGiftCar
d11"
:
{
"id"
:
""
,
"code"
:
""
,
"
vali
d11"
:
{
"id"
:
"
8366979
"
,
"code"
:
"
ValidGiftCard11
"
,
"value"
:
11
},
"
ValidGiftCar
d25"
:
{
"id"
:
""
,
"code"
:
""
,
"
vali
d25"
:
{
"id"
:
"
7441155
"
,
"code"
:
"
ValidGiftCard25
"
,
"value"
:
25
},
"
ValidGiftCar
d50"
:
{
"id"
:
""
,
"code"
:
""
,
"
vali
d50"
:
{
"id"
:
"
7438659
"
,
"code"
:
"
ValidGiftCard50
"
,
"value"
:
50
},
"expired"
:
{
"id"
:
""
,
"code"
:
""
,
"value"
:
0
"id"
:
"
7438723
"
,
"code"
:
"
ExpiredGiftCard25
"
,
"value"
:
25
},
"invalid"
:
{
"id"
:
""
,
"code"
:
""
,
"value"
:
0
"id"
:
"
42424242
"
,
"code"
:
"
InvalidGiftCard42
"
,
"value"
:
42
}
},
"discounts"
:
{
"expired"
:
{
"code"
:
""
,
"value"
:
0
"code"
:
"
expired_discount
"
,
"value"
:
1
},
"valid"
:
{
"code"
:
""
,
"value"
:
0
"code"
:
"
12_dollar_discount
"
,
"value"
:
12
}
}
}
Mobile Buy SDK/Mobile Buy SDK.xcodeproj/project.pbxproj
View file @
c45ff37d
...
...
@@ -399,6 +399,8 @@
90F593091B0D5F4C0026B382
/* BUYClientTest.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FD1B0D5F4C0026B382
/* BUYClientTest.m */
;
};
90F5930A1B0D5F4C0026B382
/* BUYLineItemTest.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FE1B0D5F4C0026B382
/* BUYLineItemTest.m */
;
};
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
90F592FF1B0D5F4C0026B382
/* BUYObjectTests.m */
;
};
9A102D1B1CDD1F960026CC43
/* BUYErrorTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
;
};
9A102D1E1CDD25980026CC43
/* BUYOptionValueTests.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A102D1D1CDD25980026CC43
/* BUYOptionValueTests.m */
;
};
9A3B2DC91CD27D5B00BFF49C
/* BUYCustomer.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A3B2DC71CD27D5B00BFF49C
/* BUYCustomer.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A3B2DCA1CD27D5B00BFF49C
/* BUYCustomer.h in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A3B2DC71CD27D5B00BFF49C
/* BUYCustomer.h */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9A3B2DCB1CD27D5B00BFF49C
/* BUYCustomer.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9A3B2DC81CD27D5B00BFF49C
/* BUYCustomer.m */
;
};
...
...
@@ -755,6 +757,8 @@
90F593001B0D5F4C0026B382
/* BUYTestConstants.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYTestConstants.h
;
sourceTree
=
"<group>"
;
};
90FC31A61B50371600AFAB51
/* BUYProductViewHeaderBackgroundImageView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
lineEnding
=
0
;
name
=
BUYProductViewHeaderBackgroundImageView.h
;
path
=
"Product View/BUYProductViewHeaderBackgroundImageView.h"
;
sourceTree
=
"<group>"
;
xcLanguageSpecificationIdentifier
=
xcode.lang.objcpp
;
};
90FC31A71B50371600AFAB51
/* BUYProductViewHeaderBackgroundImageView.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
name
=
BUYProductViewHeaderBackgroundImageView.m
;
path
=
"Product View/BUYProductViewHeaderBackgroundImageView.m"
;
sourceTree
=
"<group>"
;
};
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYErrorTests.m
;
sourceTree
=
"<group>"
;
};
9A102D1D1CDD25980026CC43
/* BUYOptionValueTests.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYOptionValueTests.m
;
sourceTree
=
"<group>"
;
};
9A3B2DC71CD27D5B00BFF49C
/* BUYCustomer.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
BUYCustomer.h
;
sourceTree
=
"<group>"
;
};
9A3B2DC81CD27D5B00BFF49C
/* BUYCustomer.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
BUYCustomer.m
;
sourceTree
=
"<group>"
;
};
9A3B2DCD1CD2822F00BFF49C
/* BUYClient+Customers.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"BUYClient+Customers.h"
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1042,6 +1046,8 @@
90F592ED1B0D5EFE0026B382
/* Mobile Buy SDK Tests */
=
{
isa
=
PBXGroup
;
children
=
(
9A102D1C1CDD257D0026CC43
/* Models Tests */
,
84CA59BA1CD1378100B2A956
/* BUYTestModel.xcdatamodeld */
,
90F592F91B0D5F4C0026B382
/* BUYApplePayAdditionsTest.m */
,
8491102E1CCE708900E53B93
/* BUYArrayAdditionsTests.m */
,
9A6B03781CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m */
,
...
...
@@ -1153,6 +1159,15 @@
name
=
"Product View"
;
sourceTree
=
"<group>"
;
};
9A102D1C1CDD257D0026CC43
/* Models Tests */
=
{
isa
=
PBXGroup
;
children
=
(
9A102D1D1CDD25980026CC43
/* BUYOptionValueTests.m */
,
9A102D1A1CDD1F960026CC43
/* BUYErrorTests.m */
,
);
name
=
"Models Tests"
;
sourceTree
=
"<group>"
;
};
BE1007981B6165CD0031CEE7
/* Cells */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -1859,6 +1874,7 @@
90F593091B0D5F4C0026B382
/* BUYClientTest.m in Sources */
,
90F5930B1B0D5F4C0026B382
/* BUYObjectTests.m in Sources */
,
90F593041B0D5F4C0026B382
/* BUYIntegrationTest.m in Sources */
,
9A102D1B1CDD1F960026CC43
/* BUYErrorTests.m in Sources */
,
90F593081B0D5F4C0026B382
/* BUYClientTest_Storefront.m in Sources */
,
90BBCD731B87B6BA00FCCE51
/* BUYPKContact.m in Sources */
,
849110331CCE708900E53B93
/* BUYStringAdditionsTests.m in Sources */
,
...
...
@@ -1867,6 +1883,7 @@
84CA59BC1CD1378100B2A956
/* BUYTestModel.xcdatamodeld in Sources */
,
9A6B03791CDA5D4F0054C26E
/* BUYAccountCredentialsTests.m in Sources */
,
8491103C1CCE731900E53B93
/* BUYURLAdditionsTests.m in Sources */
,
9A102D1E1CDD25980026CC43
/* BUYOptionValueTests.m in Sources */
,
8491104A1CCEA85C00E53B93
/* BUYObserverTests.m in Sources */
,
8498DCCB1CDD208200BD12A8
/* BUYCoreDataModelAdditionsTests.m in Sources */
,
906CF1AD1B8B5F7D001F7D5B
/* BUYNSPersonNameComponents.m in Sources */
,
...
...
Mobile Buy SDK/Mobile Buy SDK/Data/BUYClient+Customers.m
View file @
c45ff37d
...
...
@@ -64,7 +64,7 @@
return
[
self
getRequestForURL
:
components
.
URL
completionHandler
:
^
(
NSDictionary
*
json
,
NSURLResponse
*
response
,
NSError
*
error
)
{
BUYCustomer
*
customer
=
nil
;
if
(
json
&&
!
error
)
{
customer
=
[
self
.
modelManager
customerWithJSONDictionary
:
json
[
@"customer"
]
];
customer
=
[
self
.
modelManager
customerWithJSONDictionary
:
json
];
}
block
(
customer
,
error
);
}];
...
...
Mobile Buy SDK/Mobile Buy SDK/Models/Persistent/BUYCustomer.m
View file @
c45ff37d
...
...
@@ -47,5 +47,4 @@
NSDictionary
*
customerDictionary
=
[
json
objectForKey
:
@"customer"
];
return
(
id
)[
self
buy_objectWithEntityName
:[
BUYCustomer
entityName
]
JSONDictionary
:
customerDictionary
];
}
@end
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