def test_LUCI_CF_018(self, description, couponConfig, claimObject, validTillDay): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfig) LuciHelper.claimCouponSeries(self, couponSeriesId, claimObject) couponConfigObj = LuciHelper.getCouponConfigAndAssertion( self, couponSeriesId, 0, 0) Assertion.constructAssertion( long(couponConfigObj['ownerValidity']) > 0, 'Owner Validity is set Actual: {}'.format( couponConfigObj['ownerValidity'])) couponConfigObj.update({ 'valid_till_date': Utils.getTime(days=validTillDay, milliSeconds=True), 'ownerValidity': Utils.getTime(days=validTillDay, milliSeconds=True) }) LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj) couponConfigObj = LuciHelper.getCouponConfigAndAssertion( self, couponSeriesId, 0, 0) Assertion.constructAssertion( long(couponConfigObj['valid_till_date']) > 0, 'valid_till_date is set Actual: {}'.format( couponConfigObj['valid_till_date'])) Assertion.constructAssertion( long(couponConfigObj['ownerValidity']) > 0, 'Owner Validity is set Actual: {}'.format( couponConfigObj['ownerValidity']))
def test_LUCI_CF_004(self, description, couponConfig, claimObject, updateClaim, expected): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfig) LuciHelper.claimCouponSeries(self, couponSeriesId, claimObject) #Re-claim with Diff owners LuciHelper.claimCouponSeries(self, couponSeriesId, updateClaim, expectedErrors=expected, claimResult=False)
def test_LUCI_CF_016(self, description, couponConfig, claimObject): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfig) LuciHelper.claimCouponSeries(self, couponSeriesId, claimObject) LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 0, 0, {'ownedBy': claimObject[0]}) LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 0, 0, {'ownerId': claimObject[1]}) LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 0, 0, { 'ownedBy': claimObject[0], 'ownerId': claimObject[1] })
def test_LUCI_CF_011(self, description, couponConfig, claimObject, updateClaim, expected): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfig) LuciHelper.claimCouponSeries(self, couponSeriesId, claimObject) LuciHelper.invalidateCouponAndAssertions(self, couponSeriesId, numRevoked=0) LuciHelper.claimCouponSeries(self, couponSeriesId, updateClaim, expected, claimResult=False)
def test_LUCI_CF_003(self, description, couponConfig, claimObject): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfig) voucherType = LuciDBHelper.getCouponSeriesType( couponSeriesId)['seriesType'] Assertion.constructAssertion( voucherType == couponConfig['series_type'], 'Coupon Series Type in voucher_series Actual : {} and Expected : {}' .format(voucherType, couponConfig['series_type'])) Assertion.constructAssertion( self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId, constant.config['requestId']) == 0, 'Coupons Not Pumped to Queue') LuciHelper.claimCouponSeries(self, couponSeriesId, claimObject)
def test_LUCI_CF_SC_021(self): # Save Coupon Config couponSeriesId1 = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'valid_till_date': Utils.getTime(days=1, milliSeconds=True), 'expiry_strategy_value': 5, 'expiry_strategy_type': 'DAYS', 'campaign_id': -1, 'series_type': 'UNDEFINED', 'owned_by': 0 })[1] LuciHelper.claimCouponSeries( self, couponSeriesId1, [2, constant.config['campaignId'], 'CAMPAIGN'], ownerValidityDays=2) couponSeriesId2 = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'valid_till_date': Utils.getTime(days=2, milliSeconds=True), 'expiry_strategy_value': 5, 'expiry_strategy_type': 'DAYS', 'campaign_id': -1, 'series_type': 'UNDEFINED', 'owned_by': 0 })[1] LuciHelper.claimCouponSeries( self, couponSeriesId2, [2, constant.config['campaignId'], 'CAMPAIGN'], ownerValidityDays=3) couponSeriesId3 = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'valid_till_date': None, 'expiry_strategy_value': 5, 'expiry_strategy_type': 'DAYS', 'campaign_id': -1, 'series_type': 'UNDEFINED', 'owned_by': 0 })[1] LuciHelper.claimCouponSeries( self, couponSeriesId3, [2, constant.config['campaignId'], 'CAMPAIGN'], ownerValidityDays=3) couponSeriesId4 = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'valid_till_date': None, 'expiry_strategy_value': 5, 'expiry_strategy_type': 'DAYS', 'campaign_id': -1, 'series_type': 'UNDEFINED', 'owned_by': 0 })[1] LuciHelper.claimCouponSeries( self, couponSeriesId4, [2, constant.config['campaignId'], 'CAMPAIGN'], ownerValidityDays=4) couponCode1 = LuciHelper.issueCouponAndAssertions( self, couponSeriesId1)[0] couponCode2 = LuciHelper.issueCouponAndAssertions( self, couponSeriesId2)[0] couponCode3 = LuciHelper.issueCouponAndAssertions( self, couponSeriesId3)[0] couponCode4 = LuciHelper.issueCouponAndAssertions( self, couponSeriesId4)[0] couponSearchRequest = { 'orderBy': self.constructObj.orderBy['EXPIRY_DATE'], 'sort': self.constructObj.sort['DESC'] } LuciHelper.couponSearchAndAssertion( self, [ couponSeriesId1, couponSeriesId2, couponSeriesId3, couponSeriesId4 ], couponSearchRequest, [couponCode4, couponCode3, couponCode2, couponCode1]) couponSearchRequest = { 'orderBy': self.constructObj.orderBy['EXPIRY_DATE'], 'sort': self.constructObj.sort['ASC'] } LuciHelper.couponSearchAndAssertion( self, [ couponSeriesId1, couponSeriesId2, couponSeriesId3, couponSeriesId4 ], couponSearchRequest, [couponCode1, couponCode2, couponCode3, couponCode4])