def invalidateCouponAndAssertions(self, couponSeriesId, couponCode=None, numRevoked=1, couponSeriesInfo=[True, False]): if couponSeriesInfo[0]: invalidateCouponRequest = LuciObject.invalidateCouponRequest( {'couponSeriesId': couponSeriesId}) else: couponsToBeInvalidated = [ LuciObject.issuedCouponDetails({ 'couponCode': couponCode, 'issuedTo': self.userId }) ] invalidateCouponRequest = LuciObject.invalidateCouponRequest({ 'couponSeriesId': couponSeriesId, 'couponsToBeInvalidated': couponsToBeInvalidated }) Assertion.constructAssertion( self.connObj.invalidateCoupons(invalidateCouponRequest) == True, 'Requested Coupon codes are revoked') revokedCount = LuciDBHelper.getCouponsCreated_Count( couponSeriesId, not couponSeriesInfo[0]) if 'GENERIC' not in couponSeriesInfo: Assertion.constructAssertion( revokedCount != 0, 'Coupons code marked as invalid in coupons_created') Assertion.constructAssertion( LuciDBHelper.getCouponsIssued_Count(couponSeriesId, 0) == numRevoked, 'Revoked the Issued coupon code') queueSize = (self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId, constant.config['requestId'])) if True in couponSeriesInfo: Assertion.constructAssertion( queueSize == 0, 'Revoked Coupons Cleared from Queue Actual: {}'.format( queueSize)) else: Assertion.constructAssertion( queueSize != 0, 'Coupon Series not revoked from Queue Actual: {}'.format( queueSize))
def revokeCoupon(self, couponSeriesId, issuedCoupon, revokeType=-1, reqDict={}): tmpDict = {'couponSeriesId': couponSeriesId} tmpDict.update(reqDict) invalidateCouponRequest = None if revokeType in [0, 1]: invalidateCouponRequest = LuciObject.invalidateCouponRequest( tmpDict) else: couponsToBeInvalidated = LuciHelper.constructInvalidateCoupon( self.constructObj.revokeType[revokeType], issuedCoupon) tmpDict.update({'couponsToBeInvalidated': couponsToBeInvalidated}) invalidateCouponRequest = LuciObject.invalidateCouponRequest( tmpDict) if invalidateCouponRequest != None: Assertion.constructAssertion( self.connObj.invalidateCoupons(invalidateCouponRequest) == True, 'Requested Coupon codes are revoked CouponSeriesId : {}'. format(couponSeriesId)) else: Logger.log('Invalidate Coupon Request Object not constructed')
def test_authorize_sms_using_revokedvoucherseries(self, description, messageInfo): invalidateCouponReq = LuciObject.invalidateCouponRequest({'orgId' : constant.config['orgId'], 'couponSeriesId' : int(self.voucherId)}) Logger.log('Is Revoked Coupons : ' , self.luciObj.invalidateCoupons(invalidateCouponReq)) authorizeResult = authorize.authorizeCampaign(self, messageInfo, False) authorize.assertAuthorize(authorizeResult['authorizeResponse'], 200) authorize.dbAssertAuthorize(authorizeResult)