Skip to content

Commit 579a883

Browse files
committed
ECWID-141547 test discountsAllowed field in product entities
1 parent 2940033 commit 579a883

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/test/kotlin/com/ecwid/apiclient/v3/entity/ProductsTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ class ProductsTest : BaseEntityTest() {
429429

430430
// Creating new product
431431
val productCreateRequest = ProductCreateRequest(
432-
newProduct = generateTestProduct(categoryIds = categoryIds)
432+
newProduct = generateTestProduct(categoryIds = categoryIds, discountsAllowed = true)
433433
)
434434
val productCreateResult = apiClient.createProduct(productCreateRequest)
435435
assertTrue(productCreateResult.id > 0)
@@ -445,9 +445,8 @@ class ProductsTest : BaseEntityTest() {
445445
// Completely updating newly created product
446446
val productUpdateRequest = ProductUpdateRequest(
447447
productId = productDetails1.id,
448-
updatedProduct = generateTestProduct(categoryIds = categoryIds).withUnchangedShowOnFrontend(
449-
productCreateRequest
450-
)
448+
updatedProduct = generateTestProduct(categoryIds = categoryIds, discountsAllowed = false)
449+
.withUnchangedShowOnFrontend(productCreateRequest)
451450
)
452451
val productUpdateResult1 = apiClient.updateProduct(productUpdateRequest)
453452
assertEquals(1, productUpdateResult1.updateCount)
@@ -1344,7 +1343,7 @@ private fun generateTestCategory(parentId: Int? = null): UpdatedCategory {
13441343
)
13451344
}
13461345

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

14211420
tax = TaxInfo(),
14221421

1422+
discountsAllowed = discountsAllowed,
14231423
subtitle = "Subtitle sample",
14241424
ribbon = Ribbon(
14251425
"Ribbon",

0 commit comments

Comments
 (0)