-
Notifications
You must be signed in to change notification settings - Fork 769
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
Modules activities #3057
Modules activities #3057
Changes from 1 commit
8bdbbae
89509aa
03340ba
a0c2acb
0171679
e7e03cb
97b2639
d0de9a9
c830408
2d9dfc9
0c4a4db
a026019
f2702ae
90c4f20
d019263
30ca359
e67b1d9
9b71cd2
bf08739
921a52d
fb6be8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,9 @@ func TestHandleModuleActivitiesBidderRequestPayload(t *testing.T) { | |
activityControl := privacy.NewActivityControl(test.privacyConfig) | ||
newPayload := handleModuleActivities(test.hookCode, activityControl, test.inPayloadData) | ||
assert.Equal(t, test.expectedPayloadData.Request.BidRequest, newPayload.Request.BidRequest) | ||
//check input payload didn't change | ||
origInPayloadData := test.inPayloadData | ||
assert.Equal(t, origInPayloadData, test.inPayloadData) | ||
}) | ||
} | ||
} | ||
|
@@ -104,6 +107,9 @@ func TestHandleModuleActivitiesProcessedAuctionRequestPayload(t *testing.T) { | |
activityControl := privacy.NewActivityControl(test.privacyConfig) | ||
newPayload := handleModuleActivities(test.hookCode, activityControl, test.inPayloadData) | ||
assert.Equal(t, test.expectedPayloadData.Request.BidRequest, newPayload.Request.BidRequest) | ||
//check input payload didn't change | ||
origInPayloadData := test.inPayloadData | ||
assert.Equal(t, origInPayloadData, test.inPayloadData) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to move the line |
||
}) | ||
} | ||
} | ||
|
@@ -137,6 +143,9 @@ func TestHandleModuleActivitiesNoBidderRequestPayload(t *testing.T) { | |
activityControl := privacy.NewActivityControl(test.privacyConfig) | ||
newPayload := handleModuleActivities(test.hookCode, activityControl, test.inPayloadData) | ||
assert.Equal(t, test.expectedPayloadData, newPayload) | ||
//check input payload didn't change | ||
origInPayloadData := test.inPayloadData | ||
assert.Equal(t, origInPayloadData, test.inPayloadData) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to move the line |
||
}) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -672,66 +672,6 @@ func TestExecuteRawAuctionStage(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
description: "Group payload not changes with transmitUFPD activity restriction", | ||
givenBody: body, | ||
givenUrl: urlString, | ||
givenPlanBuilder: TestWithModuleContextsPlanBuilder{}, | ||
givenAccount: account, | ||
expectedBody: body, | ||
expectedReject: nil, | ||
expectedModuleContexts: &moduleContexts{ctxs: map[string]hookstage.ModuleContext{ | ||
"module-1": {"raw-auction-ctx-1": "some-ctx-1", "raw-auction-ctx-3": "some-ctx-3"}, | ||
"module-2": {"raw-auction-ctx-2": "some-ctx-2"}, | ||
}}, | ||
privacyConfig: getTransmitUFPDActivityConfig("foo", false), | ||
expectedStageOutcomes: []StageOutcome{ | ||
{ | ||
Entity: entityAuctionRequest, | ||
Stage: hooks.StageRawAuctionRequest.String(), | ||
Groups: []GroupOutcome{ | ||
{ | ||
InvocationResults: []HookOutcome{ | ||
{ | ||
AnalyticsTags: hookanalytics.Analytics{}, | ||
HookID: HookID{ModuleCode: "module-1", HookImplCode: "foo"}, | ||
Status: StatusSuccess, | ||
Action: ActionNone, | ||
Message: "", | ||
DebugMessages: nil, | ||
Errors: nil, | ||
Warnings: nil, | ||
}, | ||
{ | ||
AnalyticsTags: hookanalytics.Analytics{}, | ||
HookID: HookID{ModuleCode: "module-2", HookImplCode: "baz"}, | ||
Status: StatusSuccess, | ||
Action: ActionNone, | ||
Message: "", | ||
DebugMessages: nil, | ||
Errors: nil, | ||
Warnings: nil, | ||
}, | ||
}, | ||
}, | ||
{ | ||
InvocationResults: []HookOutcome{ | ||
{ | ||
AnalyticsTags: hookanalytics.Analytics{}, | ||
HookID: HookID{ModuleCode: "module-1", HookImplCode: "bar"}, | ||
Status: StatusSuccess, | ||
Action: ActionNone, | ||
Message: "", | ||
DebugMessages: nil, | ||
Errors: nil, | ||
Warnings: nil, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
for _, test := range testCases { | ||
|
@@ -1231,68 +1171,15 @@ func TestExecuteBidderRequestStage(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
description: "Group payload not changes with transmitUFPD activity restriction", | ||
givenBidderRequest: &openrtb2.BidRequest{ID: "some-id", User: &openrtb2.User{ID: "user-id"}}, | ||
givenPlanBuilder: TestWithModuleContextsPlanBuilder{}, | ||
givenAccount: account, | ||
expectedBidderRequest: expectedBidderRequest, | ||
expectedReject: nil, | ||
expectedModuleContexts: &moduleContexts{ctxs: map[string]hookstage.ModuleContext{ | ||
"module-1": {"bidder-request-ctx-1": "some-ctx-1"}, | ||
"module-2": {"bidder-request-ctx-2": "some-ctx-2"}, | ||
}}, | ||
privacyConfig: getTransmitUFPDActivityConfig("foo", false), | ||
expectedStageOutcomes: []StageOutcome{ | ||
{ | ||
ExecutionTime: ExecutionTime{}, | ||
Entity: entity(bidderName), | ||
Stage: hooks.StageBidderRequest.String(), | ||
Groups: []GroupOutcome{ | ||
{ | ||
ExecutionTime: ExecutionTime{}, | ||
InvocationResults: []HookOutcome{ | ||
{ | ||
ExecutionTime: ExecutionTime{}, | ||
AnalyticsTags: hookanalytics.Analytics{}, | ||
HookID: HookID{ModuleCode: "module-1", HookImplCode: "foo"}, | ||
Status: StatusSuccess, | ||
Action: ActionNone, | ||
Message: "", | ||
DebugMessages: nil, | ||
Errors: nil, | ||
Warnings: nil, | ||
}, | ||
}, | ||
}, | ||
{ | ||
ExecutionTime: ExecutionTime{}, | ||
InvocationResults: []HookOutcome{ | ||
{ | ||
ExecutionTime: ExecutionTime{}, | ||
AnalyticsTags: hookanalytics.Analytics{}, | ||
HookID: HookID{ModuleCode: "module-2", HookImplCode: "bar"}, | ||
Status: StatusSuccess, | ||
Action: ActionNone, | ||
Message: "", | ||
DebugMessages: nil, | ||
Errors: nil, | ||
Warnings: nil, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
for _, test := range testCases { | ||
t.Run(test.description, func(t *testing.T) { | ||
exec := NewHookExecutor(test.givenPlanBuilder, EndpointAuction, &metricsConfig.NilMetricsEngine{}) | ||
exec.SetAccount(test.givenAccount) | ||
ac := privacy.NewActivityControl(test.privacyConfig) | ||
privacyConfig := getTransmitUFPDActivityConfig("foo", false) | ||
ac := privacy.NewActivityControl(privacyConfig) | ||
exec.SetActivityControl(ac) | ||
exec.SetAccount(test.givenAccount) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you able to add this to all six stage tests?
|
||
|
||
reject := exec.ExecuteBidderRequestStage(&openrtb_ext.RequestWrapper{BidRequest: test.givenBidderRequest}, bidderName) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to move the line
origInPayloadData := test.inPayloadData
above the call tohandleModuleActivities
.