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

Add functional tests for account PriceGranularity config #3517

Open
wants to merge 2 commits into
base: price-granularity-defaults-fix
Choose a base branch
from

Conversation

osulzhenko
Copy link
Collaborator

@osulzhenko osulzhenko commented Oct 18, 2024

🔧 Type of changes

  • new bid adapter
  • update bid adapter
  • new feature
  • new analytics adapter
  • new module
  • bugfix
  • documentation
  • configuration
  • tech debt (test coverage, refactorings, etc.)

✨ 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

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

@osulzhenko osulzhenko added the tests Functional or other tests label Oct 18, 2024
@osulzhenko osulzhenko self-assigned this Oct 18, 2024
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))
Copy link
Collaborator

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"() {
Copy link
Collaborator

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"() {
Copy link
Collaborator

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"() {
Copy link
Collaborator

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"

Comment on lines 1135 to 1139
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)
Copy link
Collaborator

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"() {
Copy link
Collaborator

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"

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

Successfully merging this pull request may close these issues.

2 participants