@@ -43,7 +43,7 @@ class IterableAPITests: XCTestCase {
43
43
IterableAPI . initialize ( apiKey: IterableAPITests . apiKey, networkSession: networkSession)
44
44
IterableAPI . email = IterableAPITests . email
45
45
IterableAPI . track ( event: eventName, dataFields: nil , onSuccess: { ( json) in
46
- TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: ITBConsts . apiEndpoint , path: . ITBL_ENDPOINT_TRACK , queryParams: [ ( name: " api_key " , IterableAPITests . apiKey) ] )
46
+ TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: . ITBL_ENDPOINT_API , path: . ITBL_PATH_TRACK , queryParams: [ ( name: " api_key " , IterableAPITests . apiKey) ] )
47
47
let body = networkSession. getRequestBody ( )
48
48
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_EVENT_NAME, andValue: eventName, inDictionary: body)
49
49
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_EMAIL, andValue: IterableAPITests . email, inDictionary: body)
@@ -88,7 +88,7 @@ class IterableAPITests: XCTestCase {
88
88
IterableAPI . email = IterableAPITests . email
89
89
let dataFields : Dictionary < String , String > = [ " var1 " : " val1 " , " var2 " : " val2 " ]
90
90
IterableAPI . updateUser ( dataFields, mergeNestedObjects: true , onSuccess: { ( json) in
91
- TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: ITBConsts . apiEndpoint , path: . ITBL_ENDPOINT_UPDATE_USER , queryParams: [ ( name: " api_key " , IterableAPITests . apiKey) ] )
91
+ TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: . ITBL_ENDPOINT_API , path: . ITBL_PATH_UPDATE_USER , queryParams: [ ( name: " api_key " , IterableAPITests . apiKey) ] )
92
92
let body = networkSession. getRequestBody ( )
93
93
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_EMAIL, andValue: IterableAPITests . email, inDictionary: body)
94
94
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_MERGE_NESTED, andValue: true , inDictionary: body)
@@ -117,8 +117,8 @@ class IterableAPITests: XCTestCase {
117
117
onSuccess: { json in
118
118
TestUtils . validate ( request: networkSession. request!,
119
119
requestType: . post,
120
- apiEndPoint: ITBConsts . apiEndpoint ,
121
- path: . ITBL_ENDPOINT_UPDATE_EMAIL ,
120
+ apiEndPoint: . ITBL_ENDPOINT_API ,
121
+ path: . ITBL_PATH_UPDATE_EMAIL ,
122
122
queryParams: [ ( name: " api_key " , value: IterableAPITests . apiKey) ] )
123
123
let body = networkSession. getRequestBody ( )
124
124
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_NEW_EMAIL, andValue: newEmail, inDictionary: body)
@@ -249,7 +249,7 @@ class IterableAPITests: XCTestCase {
249
249
networkSession. callback = nil
250
250
IterableAPI . disableDeviceForCurrentUser ( withOnSuccess: { ( json) in
251
251
let body = networkSession. getRequestBody ( ) as! [ String : Any ]
252
- TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: ITBConsts . apiEndpoint , path: . ITBL_ENDPOINT_DISABLE_DEVICE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
252
+ TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: . ITBL_ENDPOINT_API , path: . ITBL_PATH_DISABLE_DEVICE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
253
253
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_TOKEN, andValue: ( token as NSData ) . iteHexadecimalString ( ) , inDictionary: body)
254
254
TestUtils . validateElementPresent ( withName
: AnyHashable . ITBL_KEY_EMAIL
, andValue
: " [email protected] " , inDictionary
: body
)
255
255
expectation. fulfill ( )
@@ -275,7 +275,7 @@ class IterableAPITests: XCTestCase {
275
275
networkSession. callback = nil
276
276
IterableAPI . disableDeviceForAllUsers ( withOnSuccess: { ( json) in
277
277
let body = networkSession. getRequestBody ( ) as! [ String : Any ]
278
- TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: ITBConsts . apiEndpoint , path: . ITBL_ENDPOINT_DISABLE_DEVICE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
278
+ TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: . ITBL_ENDPOINT_API , path: . ITBL_PATH_DISABLE_DEVICE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
279
279
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_TOKEN, andValue: ( token as NSData ) . iteHexadecimalString ( ) , inDictionary: body)
280
280
TestUtils . validateElementNotPresent ( withName: AnyHashable . ITBL_KEY_EMAIL, inDictionary: body)
281
281
TestUtils . validateElementNotPresent ( withName: AnyHashable . ITBL_KEY_USER_ID, inDictionary: body)
@@ -320,7 +320,7 @@ class IterableAPITests: XCTestCase {
320
320
321
321
IterableAPI . track ( purchase: 10.55 , items: [ ] , dataFields: nil , onSuccess: { ( json) in
322
322
let body = networkSession. getRequestBody ( ) as! [ String : Any ]
323
- TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: ITBConsts . apiEndpoint , path: . ITBL_ENDPOINT_COMMERCE_TRACK_PURCHASE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
323
+ TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: . ITBL_ENDPOINT_API , path: . ITBL_PATH_COMMERCE_TRACK_PURCHASE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
324
324
TestUtils . validateMatch ( keyPath: KeyPath ( " \( AnyHashable . ITBL_KEY_USER) . \( AnyHashable . ITBL_KEY_USER_ID) " ) , value: " zeeUserId " , inDictionary: body)
325
325
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_TOTAL, andValue: 10.55 , inDictionary: body)
326
326
@@ -350,7 +350,7 @@ class IterableAPITests: XCTestCase {
350
350
351
351
IterableAPI . track ( purchase: total, items: items, dataFields: nil , onSuccess: { ( json) in
352
352
let body = networkSession. getRequestBody ( ) as! [ String : Any ]
353
- TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: ITBConsts . apiEndpoint , path: . ITBL_ENDPOINT_COMMERCE_TRACK_PURCHASE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
353
+ TestUtils . validate ( request: networkSession. request!, requestType: . post, apiEndPoint: . ITBL_ENDPOINT_API , path: . ITBL_PATH_COMMERCE_TRACK_PURCHASE , queryParams: [ ( name: AnyHashable . ITBL_KEY_API_KEY, value: IterableAPITests . apiKey) ] )
354
354
TestUtils . validateMatch ( keyPath
: KeyPath ( " \( AnyHashable . ITBL_KEY_USER
) . \( AnyHashable . ITBL_KEY_EMAIL
) " ) , value
: " [email protected] " , inDictionary
: body
)
355
355
TestUtils . validateElementPresent ( withName: AnyHashable . ITBL_KEY_TOTAL, andValue: total, inDictionary: body)
356
356
let itemsElement = body [ AnyHashable . ITBL_KEY_ITEMS] as! [ [ AnyHashable : Any ] ]
0 commit comments