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

Capture SeatNonBids for rejected creatives due to insecurity and invalid size #3376

Merged
merged 7 commits into from
Feb 1, 2024

Conversation

ashishshinde-pubm
Copy link
Contributor

@ashishshinde-pubm ashishshinde-pubm commented Dec 22, 2023

This PR capture the seatNonBids when bids are rejected due to following reasons -

  • 351 Response Rejected - Invalid Creative (Size Not Allowed)
  • 352 Response Rejected - Invalid Creative (Not Secure)

Refer issue - #2852

@ashishshinde-pubm ashishshinde-pubm changed the title Add NonBR reason code 351 and 352 for response rejection scenarios Capture SeatNonBids for rejected creatives due to insecurity and invalid size Dec 27, 2023
@ashishshinde-pubm ashishshinde-pubm marked this pull request as ready for review December 27, 2023 03:25
AlexBVolcy
AlexBVolcy previously approved these changes Jan 5, 2024
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in this file look good. However, I think it might make sense to add at least one seat nonbid JSON test in exchange/exchangetest to ensure that seat nonbids registered from makeBids are actually added to the response. At first glance, I'm not sure if an update will be needed in the JSON test framework to accommodate, though it does appear seat nonbid changes were made to it as part of the initial seat nonbid PR so maybe you could leverage them. It's also possible you could modify an existing JSON test like
exchange/exchangetest/bid_response_validation_enforce_creative.json instead of creating a new one if that makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the seatNonBid in existing exchange/exchangetest/bid_response_validation_enforce_one_bid_rejected.json file.

Copy link
Contributor

@AlexBVolcy AlexBVolcy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, close to approving. I think in line with what @bsardo said, could you also add a JSON test for the other new 352 status code?


assert.Equal(t, 0, len(resultingErrs), "%s. Test should not return errors \n", test.description)
assert.Equal(t, test.expectedNumOfBids, len(resultingBids), "%s. Test returns more valid bids than expected\n", test.description)
assert.Equal(t, test.expectedNonBids, nonBids, "%s. Test returns incorrect nonBids\n", test.description)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: can you please wrap the tests execution in t.Run function?
Like this:

//Run tests
	for _, test := range testCases {
		t.Run(test.description, func(t *testing.T) {
			e.bidValidationEnforcement = test.givenValidations
			sampleBids := test.givenBids
			nonBids := &nonBids{}
			resultingBids, resultingErrs := e.makeBid(sampleBids, sampleAuction, true, ImpExtInfoMap, bidExtResponse, test.givenSeat, "", nonBids)

			assert.Equal(t, 0, len(resultingErrs), "%s. Test should not return errors \n", test.description)
			assert.Equal(t, test.expectedNumOfBids, len(resultingBids), "%s. Test returns more valid bids than expected\n", test.description)
			assert.Equal(t, test.expectedNonBids, nonBids, "%s. Test returns incorrect nonBids\n", test.description)
		})
	}

This will follow genaral test approach and also allow per-test-case execution.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, added minor comment about unit test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants