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

Currency conversion on adapter JSON tests #2071

Merged
merged 3 commits into from Nov 18, 2021

Conversation

guscarreon
Copy link
Contributor

Pull request #1901 granted adapters the ability to convert currency inside their MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) implementation. This pull request makes possible for adapters to include their own currency conversion rates in their JSON tests in order to better assert #1901's features

Also commited in this PR are JSON tests for the impactify adapter. Impactify's implementation of MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) makes use of currency conversion and the additions to adapters/impactify/impactifytest/exemplary/sample_banner.json assert the correct conversion fo the impression bid floor, and on the other hand adapters/impactify/impactifytest/supplemental/currency_rate_not_found.json asserts a currency conversion error scenario.

@thomasdseao we'd like to hear your take on the tests added to your adapter. Please let us know if you approve.

@mansinahar mansinahar requested review from mansinahar and removed request for bsardo November 11, 2021 18:36
@mansinahar mansinahar assigned mansinahar and unassigned bsardo Nov 11, 2021
@mansinahar
Copy link
Contributor

@thomasdseao This PR makes some changes to the Impactify adpater's JSON tests to be able to test the currency conversion functionality being used in the MakeRequests implementation of Impactify. Can you please take a look when you have a chance and verify if the changes to those tests look good to you? Thanks!

Copy link
Contributor

@mansinahar mansinahar left a comment

Choose a reason for hiding this comment

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

Other than the two minor comments, this LGTM.

@@ -103,17 +105,49 @@ func loadFile(filename string) (*testSpec, error) {
//
// More assertions will almost certainly be added in the future, as bugs come up.
func runSpec(t *testing.T, filename string, spec *testSpec, bidder adapters.Bidder, isAmpTest, isVideoTest bool) {
reqInfo := adapters.ExtraRequestInfo{}
reqInfo := getTestExtraRequestInfo(t, filename, spec, isAmpTest, isVideoTest)

Copy link
Contributor

Choose a reason for hiding this comment

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

Super nitpick: Please remove the new line

reqPrebid := reqExt.GetPrebid()
if reqPrebid != nil && reqPrebid.CurrencyConversions != nil && len(reqPrebid.CurrencyConversions.ConversionRates) > 0 {
err = currency.ValidateCustomRates(reqPrebid.CurrencyConversions)
assert.NoError(t, err, "Error unmarshalling test currency rates. %s", filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't have to be a unmarshalling error so please consider rewording this message to the following:

assert.NoError(t, err, "Error validating currency rates in the test request: %s", filename)

@thomasdseao
Copy link
Contributor

@mansinahar Everything looks good 👍

@guscarreon
Copy link
Contributor Author

@mansinahar Everything looks good 👍

Thank you @thomasdseao

@guscarreon guscarreon merged commit 287cd8e into prebid:master Nov 18, 2021
wwwyyy pushed a commit to wwwyyy/prebid-server that referenced this pull request Dec 20, 2021
* 'master' of https://github.com/wwwyyy/prebid-server: (23 commits)
  Add GPID Reserved Bidder Name (prebid#2107)
  Marsmedia adapter - param zoneId can get string and int (prebid#2105)
  Algorix: add Server Region Support (prebid#2096)
  New Adapter: Bizzclick (prebid#2056)
  Collect Prometheus Go process metrics (prebid#2101)
  Added channel support (prebid#2037)
  Rubicon: update fpd fields resolving (prebid#2091)
  Beachfront - Currency conversion (prebid#2078)
  New Adapter: Groupm (Alias Of PubMatic) (prebid#2042)
  Adform adapter lacked gross/net parameter support (prebid#2084)
  add iframe sync for openx (prebid#2094)
  changes to the correct user sync url (prebid#2092)
  Smaato: Add instl to tests (prebid#2089)
  Correct MakeRequests() output assertion in adapter JSON tests (prebid#2087)
  Adview: adapter currency fix. (prebid#2060)
  New Adapter: Coinzilla (prebid#2074)
  Syncer Level ExternalURL Override (prebid#2072)
  33Across: Enable Support for SRA requests (prebid#2079)
  Currency conversion on adapter JSON tests (prebid#2071)
  New Adapter: VideoByte (prebid#2058)
  ...
jorgeluisrocha pushed a commit to jwplayer/prebid-server that referenced this pull request Sep 28, 2022
shunj-nb pushed a commit to ParticleMedia/prebid-server that referenced this pull request Nov 8, 2022
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.

None yet

5 participants