Beispiel #1
0
 def claimCouponSeries(self,
                       couponSeriesId,
                       claimRequestParams,
                       expectedErrors=[],
                       ownerValidityDays=2,
                       claimResult=True):
     claimObj = LuciObject.claimCouponConfigRequest({
         'couponSeriesId':
         couponSeriesId,
         'ownedBy':
         claimRequestParams[0],
         'ownerId':
         claimRequestParams[1],
         'ownerValidity':
         Utils.getTime(days=ownerValidityDays, milliSeconds=True)
     })
     result = self.connObj.claimCouponConfig(claimObj).__dict__
     ownerInfo = LuciDBHelper.getOwnerInfo(couponSeriesId)
     if claimResult:
         Assertion.constructAssertion(
             result['success'],
             'Coupon Series claimed by {}'.format(claimRequestParams[0]))
         LuciHelper.queuePumpWait(self, couponSeriesId)
         Assertion.constructAssertion(
             self.connObj.getQueueSize(constant.config['orgId'],
                                       couponSeriesId,
                                       constant.config['requestId']) != 0,
             'Coupons Pumped to Queue')
     else:
         Assertion.constructAssertion(
             not result['success'],
             'Re-claim Coupon Series by {}'.format(claimRequestParams[0]))
         luciExp = result['ex'].__dict__
         Assertion.constructAssertion(
             luciExp['errorCode'] == expectedErrors[0],
             'Luci Exception error code Actual: {} and Expected: {}'.format(
                 luciExp['errorCode'], expectedErrors[0]))
         Assertion.constructAssertion(
             luciExp['errorMsg'] == expectedErrors[1],
             'Luci Exception Error Msg Actual : {}'.format(
                 luciExp['errorMsg']))
     voucherType = LuciDBHelper.getCouponSeriesType(
         couponSeriesId)['seriesType']
     Assertion.constructAssertion(
         voucherType == claimRequestParams[2],
         'Coupon Series Type in voucher_series Actual : {} and Expected : {}'
         .format(voucherType, claimRequestParams[2]))
     Assertion.constructAssertion(
         ownerInfo['expiry_date'] != None,
         'Owner Expiry date is set Actual: {}'.format(
             ownerInfo['expiry_date']))
Beispiel #2
0
 def test_LUCI_CF_005(self, description, couponConfig, claimObject,
                      updateClaim, expected):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, couponConfig)
     tmpDict = {
         'couponSeriesId': couponSeriesId,
         'ownedBy': claimObject[0],
         'ownerId': claimObject[1],
         'ownerValidity': Utils.getTime(days=2, milliSeconds=True)
     }
     tmpDict.update(updateClaim)
     claimObj = LuciObject.claimCouponConfigRequest(tmpDict)
     result = self.connObj.claimCouponConfig(claimObj).__dict__
     Assertion.constructAssertion(
         not result['success'],
         'Re-claim Coupon Series by {}'.format(updateClaim))
     luciExp = result['ex'].__dict__
     Assertion.constructAssertion(
         luciExp['errorCode'] == expected[0],
         'Luci Exception error code Actual: {} and Expected: {}'.format(
             luciExp['errorCode'], expected[0]))
     Assertion.constructAssertion(
         luciExp['errorMsg'] == expected[1],
         'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))