-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into fix.hs-null-conversion
- Loading branch information
Showing
7 changed files
with
607 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
test/integrations/destinations/snapchat_custom_audience/dataDelivery/business.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import { ProxyV1TestData } from '../../../testTypes'; | ||
import { | ||
generateMetadata, | ||
generateProxyV0Payload, | ||
generateProxyV1Payload, | ||
} from '../../../testUtils'; | ||
|
||
const commonHeaders = { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
'User-Agent': 'RudderLabs', | ||
}; | ||
|
||
const commonRequestParameters = { | ||
headers: commonHeaders, | ||
JSON: { | ||
users: [ | ||
{ | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
}; | ||
|
||
export const businessV0TestScenarios = [ | ||
{ | ||
id: 'snapchat_custom_audience_v0_oauth_scenario_1', | ||
name: 'snapchat_custom_audience', | ||
description: '[Proxy v0 API] :: successfull call', | ||
successCriteria: 'Proper response from destination is received', | ||
scenario: 'Oauth', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: generateProxyV0Payload({ | ||
...commonRequestParameters, | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users', | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
destinationResponse: { | ||
response: { | ||
request_status: 'SUCCESS', | ||
request_id: '12345', | ||
users: [ | ||
{ | ||
sub_request_status: 'SUCCESS', | ||
user: { | ||
number_uploaded_users: 1, | ||
}, | ||
}, | ||
], | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; | ||
|
||
export const businessV1TestScenarios: ProxyV1TestData[] = [ | ||
{ | ||
id: 'snapchat_custom_audience_v1_oauth_scenario_1', | ||
name: 'snapchat_custom_audience', | ||
description: '[Proxy v1 API] :: successfull oauth', | ||
successCriteria: 'Proper response from destination is received', | ||
scenario: 'Oauth', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v1', | ||
input: { | ||
request: { | ||
body: generateProxyV1Payload({ | ||
...commonRequestParameters, | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users', | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}), | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
response: [ | ||
{ | ||
error: `{\"request_status\":\"SUCCESS\",\"request_id\":\"12345\",\"users\":[{\"sub_request_status\":\"SUCCESS\",\"user\":{\"number_uploaded_users\":1}}]}`, | ||
statusCode: 200, | ||
metadata: generateMetadata(1), | ||
}, | ||
], | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
]; |
213 changes: 9 additions & 204 deletions
213
test/integrations/destinations/snapchat_custom_audience/dataDelivery/data.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,206 +1,11 @@ | ||
import { businessV0TestScenarios, businessV1TestScenarios } from './business'; | ||
import { v0OauthScenarios, v1OauthScenarios } from './oauth'; | ||
import { otherScenariosV1 } from './other'; | ||
|
||
export const data = [ | ||
{ | ||
name: 'snapchat_custom_audience', | ||
description: 'Test 0', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: { | ||
version: '1', | ||
type: 'REST', | ||
method: 'POST', | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/123/users', | ||
headers: { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: { | ||
JSON: { | ||
users: [ | ||
{ | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
FORM: {}, | ||
}, | ||
files: {}, | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}, | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 200, | ||
body: { | ||
output: { | ||
status: 200, | ||
message: 'Request Processed Successfully', | ||
destinationResponse: { | ||
response: { | ||
request_status: 'SUCCESS', | ||
request_id: '12345', | ||
users: [ | ||
{ | ||
sub_request_status: 'SUCCESS', | ||
user: { | ||
number_uploaded_users: 1, | ||
}, | ||
}, | ||
], | ||
}, | ||
status: 200, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'snapchat_custom_audience', | ||
description: 'Test 1', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: { | ||
version: '1', | ||
type: 'REST', | ||
method: 'POST', | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/456/users', | ||
headers: { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: { | ||
JSON: { | ||
users: [ | ||
{ | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
FORM: {}, | ||
}, | ||
files: {}, | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}, | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 500, | ||
body: { | ||
output: { | ||
status: 500, | ||
destinationResponse: { | ||
response: 'unauthorized', | ||
status: 401, | ||
}, | ||
message: | ||
'Failed with unauthorized during snapchat_custom_audience response transformation', | ||
statTags: { | ||
destType: 'SNAPCHAT_CUSTOM_AUDIENCE', | ||
errorCategory: 'network', | ||
destinationId: 'Non-determininable', | ||
workspaceId: 'Non-determininable', | ||
errorType: 'retryable', | ||
feature: 'dataDelivery', | ||
implementation: 'native', | ||
module: 'destination', | ||
}, | ||
authErrorCategory: 'REFRESH_TOKEN', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: 'snapchat_custom_audience', | ||
description: 'Test 2', | ||
feature: 'dataDelivery', | ||
module: 'destination', | ||
version: 'v0', | ||
input: { | ||
request: { | ||
body: { | ||
version: '1', | ||
type: 'REST', | ||
method: 'DELETE', | ||
endpoint: 'https://adsapi.snapchat.com/v1/segments/789/users', | ||
headers: { | ||
Authorization: 'Bearer abcd123', | ||
'Content-Type': 'application/json', | ||
}, | ||
body: { | ||
JSON: { | ||
users: [ | ||
{ | ||
id: '123456', | ||
schema: ['EMAIL_SHA256'], | ||
data: [['938758751f5af66652a118e26503af824404bc13acd1cb7642ddff99916f0e1c']], | ||
}, | ||
], | ||
}, | ||
JSON_ARRAY: {}, | ||
XML: {}, | ||
FORM: {}, | ||
}, | ||
files: {}, | ||
params: { | ||
destination: 'snapchat_custom_audience', | ||
}, | ||
}, | ||
method: 'POST', | ||
}, | ||
}, | ||
output: { | ||
response: { | ||
status: 400, | ||
body: { | ||
output: { | ||
authErrorCategory: 'AUTH_STATUS_INACTIVE', | ||
status: 400, | ||
destinationResponse: { | ||
response: { | ||
request_status: 'ERROR', | ||
request_id: '98e2a602-3cf4-4596-a8f9-7f034161f89a', | ||
debug_message: 'Caller does not have permission', | ||
display_message: | ||
"We're sorry, but the requested resource is not available at this time", | ||
error_code: 'E3002', | ||
}, | ||
status: 403, | ||
}, | ||
message: 'undefined during snapchat_custom_audience response transformation', | ||
statTags: { | ||
destType: 'SNAPCHAT_CUSTOM_AUDIENCE', | ||
errorCategory: 'network', | ||
destinationId: 'Non-determininable', | ||
workspaceId: 'Non-determininable', | ||
errorType: 'aborted', | ||
feature: 'dataDelivery', | ||
implementation: 'native', | ||
module: 'destination', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
...v0OauthScenarios, | ||
...v1OauthScenarios, | ||
...businessV0TestScenarios, | ||
...businessV1TestScenarios, | ||
...otherScenariosV1, | ||
]; |
Oops, something went wrong.