def test_LUCI_RC_DCP_011_sanity_smoke(self, description): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'client_handling_type': 'DISC_CODE_PIN', 'max_redeem': 10 }) #upload the coupon code couponCode = LuciHelper.uploadCouponAndAssertions( self, couponSeriesId, self.constructObj.importType['NONE'])['coupons'][0] LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 0, 0) #Check in issued table couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId) Assertion.constructAssertion( couponIssuedList == [], 'Issued Coupon recorded in coupons_issued') #Checking Queue count and coupons_created count once update DC -> DCP couponsCreatedList = LuciDBHelper.getCouponsCreated(couponSeriesId) Assertion.constructAssertion( couponsCreatedList != [], 'Uploaded Coupons Added in Coupons_created table') Assertion.constructAssertion( len(couponsCreatedList) == 1, 'Uploaded Coupon recorded in DB, Actual: {} and Expected : {}'. format(len(couponsCreatedList), 1)) Assertion.constructAssertion( couponsCreatedList[0]['couponCode'] == couponCode, 'Uploaded Coupon Code, Actual : {} and Expected : {}'.format( couponsCreatedList[0]['couponCode'], couponCode)) #issueCode and Doing Assertion.constructAssertion(on) LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0] LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0) # CouponDetails Request LuciHelper.getCouponDetailsAndAssertion(self, couponSeriesId, couponCode, couponDetailsRequest={ 'onlyActive': True, 'couponCodeFilter': [couponCode] }) #Coupon Redemption LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, isMaxRedeemSet=True) LuciHelper.redemptionDBAssertion(self, couponSeriesId) # Get Coupon Configuration LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)
def test_LUCI_UC_01(self,description, couponConfig, uploadType, dracarysUploadInput): #Save Coupon Config for i in range(5): self.userIds.append(constant.config['usersInfo'][i]['userId']) couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) time.sleep(2) couponCodeList = LuciHelper.uploadCouponAndAssertions(self,couponSeriesId, self.constructObj.importType[uploadType],noOfCouponsToBeUpload=5, dracraysUpload=dracarysUploadInput)['coupons'] Logger.log('Coupon Code list : ', couponCodeList) for couponCode, self.userId in zip(couponCodeList,self.userIds): LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode, couponDetailsRequest={'onlyActive': True, 'couponCodeFilter': [couponCode]}) LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,5,0)
def test_LUCI_RC_DCP_013(self, description): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'client_handling_type': 'DISC_CODE_PIN', 'multiple_use': True, 'any_user': True }) couponCode = LuciHelper.uploadCouponAndAssertions( self, couponSeriesId, self.constructObj.importType['NONE'])['coupons'][0] #issueCode and Doing Assertion.constructAssertion(on) LuciHelper.issueCouponAndAssertions(self, couponSeriesId) LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0) LuciHelper.getCouponDetailsAndAssertion(self, couponSeriesId, couponCode, couponDetailsRequest={ 'onlyActive': True, 'couponCodeFilter': [couponCode] }) #Coupon Redemption redeemedIds = [self.userId] LuciHelper.redeemCouponAndAssertions( self, couponSeriesId, couponCode, couponIssuedTo=[constant.config['usersInfo'][0]['userId']]) self.userId = constant.config['usersInfo'][1]['userId'] redeemedIds.append(self.userId) LuciHelper.redeemCouponAndAssertions( self, couponSeriesId, couponCode, couponIssuedTo=[constant.config['usersInfo'][0]['userId']]) self.userId = constant.config['usersInfo'][2]['userId'] redeemedIds.append(self.userId) LuciHelper.redeemCouponAndAssertions( self, couponSeriesId, couponCode, couponIssuedTo=[constant.config['usersInfo'][0]['userId']]) LuciHelper.redemptionDBAssertion(self, couponSeriesId, numRedeemed=3, redeemedBy=redeemedIds) LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 3)
def test_LUCI_RC_DC_012_sanity(self,description): #Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) LuciHelper.queuePumpWait(self, couponSeriesId) LuciHelper.couponPumpAssertion(self, couponSeriesId) # issue coupon Code couponCode = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] # CouponConfigAssertion LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId, 1, 0) # redeem Coupon and Assertion.constructAssertion(on) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode) LuciHelper.redemptionDBAssertion(self, couponSeriesId) LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId, 1, 1) # GetCoupon Details and Assertion.constructAssertion(on) couponDetailsRequest = {'onlyActive': True, 'couponCodeFilter': [couponCode]} LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode,couponDetailsRequest)
def test_LUCI_RC_DC_011_sanity(self, description, uploadType): #Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) time.sleep(2) createdCouponCount = LuciDBHelper.getCouponsCreated_Count(couponSeriesId) Assertion.constructAssertion(createdCouponCount != 0, 'Coupon Code Pumped to Queue') couponCode = LuciHelper.uploadCouponAndAssertions(self,couponSeriesId,self.constructObj.importType[uploadType],dracraysUpload={'userOnly' : True})['coupons'][0] LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode) LuciHelper.redemptionDBAssertion(self, couponSeriesId) couponDetailsRequest = {'onlyActive': True, 'couponCodeFilter': [couponCode]} LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode,couponDetailsRequest) couponDetailsRequest.update({'couponSeriesRequired' : True}) LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode,couponDetailsRequest)
def test_LUCI_EI_011_sanity_smoke(self, description): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfigReq={ 'client_handling_type': 'DISC_CODE_PIN', 'any_user': True, 'isExternalIssual': True }) Assertion.constructAssertion( LuciDBHelper.isExternalCouponSeries(couponSeriesId), 'Client handling type isExternal Enabled for coupon series id: {}'. format(couponSeriesId)) #Checking Queue Count Assertion.constructAssertion( self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId, constant.config['requestId']) == 0, 'Coupon codes are cleared from queue') couponCode = LuciHelper.uploadCouponAndAssertions( self, couponSeriesId, self.constructObj.importType['NONE'])['coupons'][0] #CouponDetails Request couponDetailsRequest = { 'onlyActive': True, 'couponCodeFilter': [couponCode] } self.userId = -1 LuciHelper.getCouponDetailsAndAssertion(self, couponSeriesId, couponCode, couponDetailsRequest) LuciHelper.issuedCouponsDBAssertion(self, couponSeriesId, couponCode) self.userId = constant.config['usersInfo'][0]['userId'] LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, couponIssuedTo=[-1]) LuciHelper.redemptionDBAssertion(self, couponSeriesId) #Get Coupon Configuration LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)
def test_LUCI_RC_DC_014(self,description): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'multiple_use' : True, 'any_user' : True}) LuciHelper.queuePumpWait(self, couponSeriesId) LuciHelper.couponPumpAssertion(self, couponSeriesId) #issueCode and Doing Assertion.constructAssertion(on) couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0] LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0) LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode, couponDetailsRequest={'onlyActive': True, 'couponCodeFilter': [couponCode]}) #Coupon Redemption redeemedIds = [self.userId] LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, couponIssuedTo=[constant.config['usersInfo'][0]['userId']]) self.userId = constant.config['usersInfo'][1]['userId'] redeemedIds.append(self.userId) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, couponIssuedTo=[constant.config['usersInfo'][0]['userId']]) self.userId = constant.config['usersInfo'][2]['userId'] redeemedIds.append(self.userId) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, couponIssuedTo=[constant.config['usersInfo'][0]['userId']]) LuciHelper.redemptionDBAssertion(self,couponSeriesId, numRedeemed=3, redeemedBy=redeemedIds) LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,1,3)