Skip to content

Commit

Permalink
ECWID-141547 test discountsAllowed field in product entities
Browse files Browse the repository at this point in the history
  • Loading branch information
zenon-ecwid committed Jul 3, 2024
1 parent 60b284b commit 11d9ff8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ class ProductsTest : BaseEntityTest() {

// Creating new product
val productCreateRequest = ProductCreateRequest(
newProduct = generateTestProduct(categoryIds = categoryIds)
newProduct = generateTestProduct(categoryIds = categoryIds, discountsAllowed = true)
)
val productCreateResult = apiClient.createProduct(productCreateRequest)
assertTrue(productCreateResult.id > 0)
Expand All @@ -445,9 +445,8 @@ class ProductsTest : BaseEntityTest() {
// Completely updating newly created product
val productUpdateRequest = ProductUpdateRequest(
productId = productDetails1.id,
updatedProduct = generateTestProduct(categoryIds = categoryIds).withUnchangedShowOnFrontend(
productCreateRequest
)
updatedProduct = generateTestProduct(categoryIds = categoryIds, discountsAllowed = false)
.withUnchangedShowOnFrontend(productCreateRequest)
)
val productUpdateResult1 = apiClient.updateProduct(productUpdateRequest)
assertEquals(1, productUpdateResult1.updateCount)
Expand Down Expand Up @@ -1344,7 +1343,7 @@ private fun generateTestCategory(parentId: Int? = null): UpdatedCategory {
)
}

private fun generateTestProduct(categoryIds: List<Int> = listOf()): UpdatedProduct {
private fun generateTestProduct(categoryIds: List<Int> = listOf(), discountsAllowed: Boolean = true): UpdatedProduct {
val basePrice = randomPrice()
val enName = "Product " + randomAlphanumeric(8)
val enDescription = "Description " + randomAlphanumeric(16)
Expand Down Expand Up @@ -1420,6 +1419,7 @@ private fun generateTestProduct(categoryIds: List<Int> = listOf()): UpdatedProdu

tax = TaxInfo(),

discountsAllowed = discountsAllowed,
subtitle = "Subtitle sample",
ribbon = Ribbon(
"Ribbon",
Expand Down

0 comments on commit 11d9ff8

Please sign in to comment.