-
Notifications
You must be signed in to change notification settings - Fork 175
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
Add functional tests for account PriceGranularity config #3517
base: price-granularity-defaults-fix
Are you sure you want to change the base?
Add functional tests for account PriceGranularity config #3517
Conversation
src/test/groovy/org/prebid/server/functional/model/config/PriceGranularityType.groovy
Show resolved
Hide resolved
def "PBS should prioritize price granularity from original request over account config"() { | ||
given: "Default bidRequest with price granularity" | ||
def bidRequest = BidRequest.defaultBidRequest.tap { | ||
ext.prebid.targeting = new Targeting(priceGranularity: PriceGranularity.getDefault(priceGranularity)) |
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 suppose we always use "var" for object that gonna be in the assert block
assert exception.responseBody == 'Invalid request format: Price granularity error: empty granularity definition supplied' | ||
} | ||
|
||
def "PBS should prioritize price granularity from original request over account config"() { |
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.
PBS auction should prioritize price granularity from original request over account config
@@ -1121,6 +1126,204 @@ class TargetingSpec extends BaseSpec { | |||
assert targeting["hb_env"] == HB_ENV_AMP | |||
} | |||
|
|||
def "PBS should throw error when price granularity from original request is empty"() { |
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.
PBS auction should throw error when price granularity from original request is empty
In addition you also can add same test for amp endpoint
priceGranularity << PriceGranularityType.values() - UNKNOWN | ||
} | ||
|
||
def "PBS should include price granularity from account config when original request doesn't contain it"() { |
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.
"PBS auction should include price granularity from account config when original request doesn't contain price granularity"
and: "Account in the DB" | ||
def accountAuctionConfig = new AccountAuctionConfig(priceGranularity: PBSUtils.getRandomEnum(PriceGranularityType)) | ||
def accountConfig = new AccountConfig(status: ACTIVE, auction: accountAuctionConfig) | ||
def account = new Account(uuid: bidRequest.accountId, config: accountConfig) | ||
accountDao.save(account) |
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.
Please create a separate method for creating an account with priceGranularity
priceGranularity << PriceGranularityType.values() - UNKNOWN | ||
} | ||
|
||
def "PBS should include price granularity from account config with different name case when original request doesn't contain it"() { |
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.
"PBS auction should include price granularity from account config with different name case when original request doesn't contain price granularity"
🔧 Type of changes
✨ What's the context?
What's the context for the changes? Are there any
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check