Untitled
unknown
plain_text
3 years ago
7.6 kB
2
Indexable
Never
def test_get_promotion_owner_allow_customize_expired_time(client, session): """ ::JIRA name: [ 'Return 400 – 402 when longName is missing should return Param longName is required', 'Return 400 – 402 when maxDistributedVoucher is missing should return Param maxDistributedVoucher is required', 'Return 400 – 404 when input has campaignGroupId not found in db should return campaign group not found', 'Return 400 – 411 when longName length is greater than 255 should return Param longName is too long', 'Return 400 – 411 when shortName length is greater than 100 should return Param shortName is too long', 'Return 400 – 416 when time is invalid (startTime > endTime) should return Start time/End time must be in voucher running time', 'Return 400 – 417 when field maxDistributedVoucher is not integer should return maxDistributedVoucher format is invalid', 'Return 400 – 417 when field maxVoucherPerCustomer is not integer should return maxVoucherPerCustomer format is invalid', 'Return 400 – 417 when field maxVoucherPerCustomerPerService is not integer should return maxVoucherPerCustomerPerService format is invalid', 'Return 400 – 417 when field startTime is not integer should return startTime format is invalid', 'Return 400 – 417 when field endTime is not integer should return endTime format is invalid', 'Return 400 – 418 when endTime too large for timestamp value should return endTime is too large error', 'Return 400 – 418 when startTime too large for timestamp value should return startTime is too large error', 'Return 400 – 419 when startTime too small for timestamp value should return startTime is too small error', 'Return 400 – 419 when endTime too small for timestamp value should return endTime is too small error', 'Return 400 – 419 when maxDistributedVoucher smaller than 0 value should return maxDistributedVoucher is too small error', 'Return 400 – 419 when maxVoucherPerCustomer smaller than 0 value should return maxVoucherPerCustomer is too small error', 'Return 400 – 419 when maxVoucherPerCustomerPerService smaller than 0 value should return maxVoucherPerCustomerPerService is too small error', 'Return 400 – 420 when update maxDistributedVoucher smaller than campaign maxDistributedVoucher should return maxDistributedVoucher is invalid', 'Return 400 – 420 when update maxVoucherPerCustomer larger than maxDistributedVoucher should return maxVoucherPerCustomer is invalid', 'Return 400 – 420 when update maxVoucherPerCustomer smaller than campaign maxVoucherPerCustomer should return maxVoucherPerCustomer is invalid', 'Return 400 – 420 when update maxVoucherPerCustomerPerService larger than maxVoucherPerCustomer should return maxVoucherPerCustomerPerService is invalid', 'Return 400 - 421 when another campaign group with longName in input exists in db should return longName is duplicated', 'Return 400 - 421 when another campaign group with shortName in input exists in db should return shortName is duplicated' ] issueLinks: PERSONAL-848 folder: HN16/Marketing Portal v2/Mkt Core/upsert campaign group objective: [ 'Check upsert campaign group when input field missing (longName)', 'Check upsert campaign group when input field missing (maxDistributedVoucher)', 'Check update campaign group when passing campaignGroupId that does not exist', 'Check upsert campaign group when input has field of which length is larger than max length (longName > 255)', 'Check upsert campaign group when input has field of which length is larger than max length (shortName length > 100)', 'Check upsert campaign group when time is invalid (startTime > endTime)', 'Check upsert campaign group input field format is invalid (maxDistributedVoucher)', 'Check upsert campaign group input field format is invalid (maxVoucherPerCustomer)', 'Check upsert campaign group input field format is invalid (maxVoucherPerCustomerPerService)', 'Check upsert campaign group input field format is invalid (startTime)', 'Check upsert campaign group input field format is invalid (endTime)', 'Check upsert campaign group when input has field of which value is larger than max value (endTime > max valid timestamp)', 'Check upsert campaign group when input has field of which value is larger than max value (startTime > max valid timestamp)', 'Check upsert campaign group when input has field of which value is smaller than 0 (endTime)', 'Check upsert campaign group when input has field of which value is smaller than 0 (startTime)', 'Check upsert campaign group when input has field of which value is smaller than 0 (maxDistributedVoucher)', 'Check upsert campaign group when input has field of which value is smaller than 0 (maxVoucherPerCustomer)', 'Check upsert campaign group when input has field of which value is smaller than 0 (maxVoucherPerCustomerPerService)', 'Check update campaign group when maxDistributed < campaign maxDistributedVoucher', 'Check update campaign group when maxVoucherPerCustomer > maxDistributedVoucher', 'Check update campaign group when maxVoucherPerCustomer < campaign maxVoucherPerCustomer', 'Check update campaign group when maxVoucherPerCustomerPerService > maxVoucherPerCustomer', 'Check upsert campaign group when a campaign group with longName in request exists in db', 'Check upsert campaign group when a campaign group with shortName in request exists in db', ] precondition: [ '', '' 'Campaign group does not exist', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 'Campaign group exists', 'Campaign group exists' ] plan: Create campaign groups and campaign in db then create a post request """ promotion_owner_1 = PromotionOwnerProvider.create_promotion_owner(session, allow_customize_expired_time=True, commit=True) promotion_owner_2 = PromotionOwnerProvider.create_promotion_owner(session, allow_customize_expired_time=False, commit=True) resp = client.get('/api/v1/promotion-owners') assert resp.status_code == 200 resp_promotion_owners = resp.json()['data']['promotionOwners'] resp_promotion_owner_1 = [p for p in resp_promotion_owners if p['id'] == promotion_owner_1.id][0] assert resp_promotion_owner_1['allowCustomizeExpiredTime'] is True resp_promotion_owner_2 = [p for p in resp_promotion_owners if p['id'] == promotion_owner_2.id][0] assert resp_promotion_owner_2['allowCustomizeExpiredTime'] is False