Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: reddit proxy test refactor #3096

Merged
merged 27 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7d6ea12
feat: update proxy data type for response handler input
utsabc Jan 25, 2024
b1327eb
feat: update proxy v1 test cases
utsabc Jan 25, 2024
30c4eca
Merge branch 'develop' into fix.network-handlers
utsabc Jan 25, 2024
9dd8625
feat: update proxy tests for cm360
utsabc Jan 29, 2024
650911e
fix: typo
utsabc Jan 29, 2024
84b6a5d
Update test/integrations/destinations/campaign_manager/dataDelivery/b…
utsabc Jan 29, 2024
686f524
Update test/integrations/destinations/campaign_manager/dataDelivery/b…
utsabc Jan 29, 2024
76e0284
fix: api contract for v1 proxy
utsabc Feb 1, 2024
93947db
fix: api contract for v1 proxy (#3049)
utsabc Feb 2, 2024
d2e65f4
chore: clean up zod type
Feb 5, 2024
7ce0a66
chore: update testutils
Feb 5, 2024
99f5cb2
chore: update V0 proxy request type and zod schema
Feb 5, 2024
0504ffa
feat: update proxy tests for cm360 (#3039)
utsabc Feb 7, 2024
bd6af6b
Merge branch 'develop' into fix.network-handlers
utsabc Feb 7, 2024
014bf5e
Merge branch 'develop' of github.com:rudderlabs/rudder-transformer in…
Feb 8, 2024
b57a926
Merge branch 'fix.network-handlers' of github.com:rudderlabs/rudder-t…
Feb 8, 2024
325433b
feat: adding zod validations (#3066)
utsabc Feb 8, 2024
689b0cd
chore: update delivery test cases for criteo audience
ItsSudip Feb 8, 2024
9e04774
Revert "chore: update delivery test cases for criteo audience"
ItsSudip Feb 8, 2024
7114f9b
chore: add type def for proxy v1 test
Feb 9, 2024
33d4d62
chore: fix generateMetdata func
Feb 9, 2024
455dce7
chore: criteo audience update proxy test (#3068)
ItsSudip Feb 13, 2024
c7133b3
chore: enable batch response schema check (#3083)
chandumlg Feb 13, 2024
1a3faf0
chore: reddit proxy test refactor
mihir-4116 Feb 15, 2024
7a96454
chore: pr conflict resolved
mihir-4116 Feb 27, 2024
b6c364e
Merge branch 'develop' into reddit.refactor-proxy
mihir-4116 Feb 29, 2024
f0d4f67
chore: code review changes
mihir-4116 Feb 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions test/integrations/destinations/reddit/dataDelivery/business.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
import {
generateMetadata,
generateProxyV0Payload,
generateProxyV1Payload,
} from '../../../testUtils';

const validRequestPayload = {
events: [
{
event_at: '2019-10-14T09:03:17.562Z',
event_type: {
tracking_type: 'Purchase',
},
user: {
aaid: 'c12d34889302d3c656b5699fa9190b51c50d6f62fce57e13bd56b503d66c487a',
email: 'ac144532d9e4efeab19475d9253a879173ea12a3d2238d1cb8a332a7b3a105f2',
external_id: '7b023241a3132b792a5a33915a5afb3133cbb1e13d72879689bf6504de3b036d',
ip_address: 'e80bd55a3834b7c2a34ade23c7ecb54d2a49838227080f50716151e765a619db',
user_agent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
screen_dimensions: {},
},
event_metadata: {
item_count: 3,
products: [
{
id: '123',
name: 'Monopoly',
category: 'Games',
},
{
id: '345',
name: 'UNO',
category: 'Games',
},
],
},
},
],
};

const commonHeaders = {
Authorization: 'Bearer dummyAccessToken',
'Content-Type': 'application/json',
};

const commonRequestParameters = {
headers: commonHeaders,
JSON: validRequestPayload,
};

export const testScenariosForV0API = [
{
id: 'reddit_v0_scenario_1',
name: 'reddit',
description:
'[Proxy v0 API] :: Test for a valid request with a successful 200 response from the destination',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
input: {
request: {
body: generateProxyV0Payload({
...commonRequestParameters,
endpoint: 'https://ads-api.reddit.com/api/v2.0/conversions/events/a2_fsddXXXfsfd',
}),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
destResp: {
response: {
message: 'Successfully processed 1 conversion events.',
},
status: 200,
},
message: 'Request Processed Successfully',
status: 200,
},
},
},
},
},
];

export const testScenariosForV1API = [
{
id: 'reddit_v1_scenario_1',
name: 'reddit',
description:
'[Proxy v1 API] :: Test for a valid request with a successful 200 response from the destination',
scenario: 'Business',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload(
{
...commonRequestParameters,
endpoint: 'https://dfareporting.googleapis.com/test_url_for_valid_request',
},
[generateMetadata(1)],
),
method: 'POST',
},
},
output: {
response: {
status: 200,
body: {
output: {
message: 'Request Processed Successfully',
response: [
{
metadata: generateMetadata(1),
statusCode: 500,
},
],
status: 500,
},
},
},
},
},
];
9 changes: 9 additions & 0 deletions test/integrations/destinations/reddit/dataDelivery/data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { testScenariosForV0API, testScenariosForV1API } from './business';
import { v0oauthScenarios, v1oauthScenarios } from './oauth';

export const data = [
...v0oauthScenarios,
...v1oauthScenarios,
...testScenariosForV0API,
...testScenariosForV1API,
];
147 changes: 147 additions & 0 deletions test/integrations/destinations/reddit/dataDelivery/oauth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
import {
generateMetadata,
generateProxyV1Payload,
generateProxyV0Payload,
} from '../../../testUtils';

const authorizationRequiredRequestPayload = {
events: [
{
event_at: '2019-10-14T09:03:17.562Z',
event_type: {
tracking_type: 'ViewContent',
},
user: {
aaid: 'c12d34889302d3c656b5699fa9190b51c50d6f62fce57e13bd56b503d66c487a',
email: 'ac144532d9e4efeab19475d9253a879173ea12a3d2238d1cb8a332a7b3a105f2',
external_id: '7b023241a3132b792a5a33915a5afb3133cbb1e13d72879689bf6504de3b036d',
ip_address: 'e80bd55a3834b7c2a34ade23c7ecb54d2a49838227080f50716151e765a619db',
user_agent:
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36',
screen_dimensions: {},
},
event_metadata: {
item_count: 3,
products: [
{
id: '123',
name: 'Monopoly',
category: 'Games',
},
{
id: '345',
name: 'UNO',
category: 'Games',
},
],
},
},
],
};

const commonHeaders = {
Authorization: 'Bearer dummyAccessToken',
'Content-Type': 'application/json',
};

const commonRequestParameters = {
headers: commonHeaders,
JSON: authorizationRequiredRequestPayload,
};

const expectedStatTags = {
destType: 'REDDIT',
destinationId: 'default-destinationId',
errorCategory: 'network',
errorType: 'retryable',
feature: 'dataDelivery',
implementation: 'native',
module: 'destination',
workspaceId: 'default-workspaceId',
};

export const v0oauthScenarios = [
{
id: 'reddit_v0_oauth_scenario_1',
name: 'reddit',
description: '[Proxy v0 API] :: Oauth where Authorization Required response from destination',
successCriteria: 'Should return 500 with authErrorCategory as REFRESH_TOKEN',
scenario: 'Oauth',
feature: 'dataDelivery',
module: 'destination',
version: 'v0',
input: {
request: {
body: generateProxyV0Payload({
...commonRequestParameters,
endpoint: 'https://ads-api.reddit.com/api/v2.0/conversions/events/a2_gsddXXXfsfd',
}),
method: 'POST',
},
},
output: {
response: {
status: 500,
body: {
output: {
authErrorCategory: 'REFRESH_TOKEN',
destinationResponse: {
response: 'Authorization Required',
status: 401,
},
message:
"Request failed due to Authorization Required 'during reddit response transformation'",
statTags: expectedStatTags,
status: 500,
},
},
},
},
},
];

export const v1oauthScenarios = [
{
id: 'reddit_v1_oauth_scenario_1',
name: 'reddit',
description: '[Proxy v1 API] :: Oauth where Authorization Required response from destination',
successCriteria: 'Should return 500 with authErrorCategory as REFRESH_TOKEN',
scenario: 'Oauth',
feature: 'dataDelivery',
module: 'destination',
version: 'v1',
input: {
request: {
body: generateProxyV1Payload(
{
...commonRequestParameters,
endpoint: 'https://ads-api.reddit.com/api/v2.0/conversions/events/a2_gsddXXXfsfd',
},
[generateMetadata(1)],
),
method: 'POST',
},
},
output: {
response: {
status: 500,
body: {
output: {
authErrorCategory: 'REFRESH_TOKEN',
message:
"Request failed due to Authorization Required 'during reddit response transformation'",
response: [
{
error: '"Authorization Required"',
metadata: generateMetadata(1),
statusCode: 500,
},
],
statTags: expectedStatTags,
status: 500,
},
},
},
},
},
];
Loading
Loading