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 irisv2_message_edit_PARTICULARDATE_upcoming_create_execute_plain_mobile_schedulle_body_Sanity( self, campaignType, testControlType, listType, channel, messageInfo): messageDetails = CreateMessage.create(campaignType, testControlType, listType, channel, messageInfo, updateNode=True, lockNode=True) CreateMessage.assertResponse(messageDetails['RESPONSE'], 200) message_calls().waitForJobDetailsStatusToClose( messageDetails['RESPONSE']['json']['entity']['id'], 'VARIANT_CREATION') dateTime = Utils.getTime(hours=5, minutes=32, dateTimeFormat=True) messageDetails['PAYLOAD'].update({ 'schedule': { 'startDate': Utils.getTime(minutes=1, seconds=25, milliSeconds=True), 'endDate': Utils.getTime(minutes=40, milliSeconds=True), 'repeatOn': [1], 'repeatType': 'DAILY', 'scheduleType': 'RECURRING', 'hour': int(dateTime[11:13]), 'minute': int(dateTime[14:16]) } }) editInfo = CreateMessage.edit( constant.config['node'][campaignType][testControlType]['CAMPAIGN'] ['ID'], messageDetails['RESPONSE']['json']['entity']['id'], messageDetails['PAYLOAD']) CreateMessage.assertResponse(editInfo['RESPONSE'], 200) message_calls().waitForJobDetailsStatusToClose( editInfo['RESPONSE']['json']['entity']['id'], 'VARIANT_CREATION', version=1) approveRespone = AuthorizeMessage.approve( campaignType, testControlType, listType, channel, messageInfo, messageCreateResponse=editInfo) AuthorizeMessage.assertResponse(approveRespone, 200) campaignId = constant.config['node'][campaignType][testControlType][ 'CAMPAIGN']['ID'] AuthorizeMessageDBAssertion(campaignId, editInfo['RESPONSE'], editInfo['PAYLOAD'], testControlType, version=1).check()
def emailBody(emailBodyDict={}): tmpDict = { 'body': 'test body', 'orgId': constant.config['orgId'], 'createdTime': str(Utils.getTime()), 'retrievedTime': str(Utils.getTime()), 'subject': 'test subject' } tmpDict.update(emailBodyDict) return veneno.EmailBody(**tmpDict)
def BulkExpiryReportData(bulkExpiryReportData): tmpDict = { 'orgId': constant.config['orgId'], 'loggedInUserId': 0, 'fromTimeInMillis': Utils.getTime(days=-1, milliSeconds=True), 'toTimeInMillis': Utils.getTime(milliSeconds=True), 'includeExpired': True, 'includeRedeemed': True } tmpDict.update(bulkExpiryReportData) return peb.BulkExpiryReportData(**tmpDict)
def redeemCoupon(requestDict={}): tmpDict = { 'orgId': constant.config['orgId'], 'couponCode': None, 'storeUnitId': 1, 'billAmount': 1000, 'billNumber': str(Utils.getTime(milliSeconds=True)), 'eventTimeInMillis': Utils.getTime(milliSeconds=True) } tmpDict.update(requestDict) return luci.RedeemCoupon(**tmpDict)
def PointsRedemptionEventData(paramDict={}): constant.config['uniqueId'] = randValues.randomString(8) tmpDict = { 'orgID': constant.config['orgId'], 'customerID': 0, 'numPointsToBeRedeemed': constant.config['defaultRedeemPts'], 'redeemedAtStoreUnitId': constant.config['storeIds'][0], 'redeemedOnBillNumber': '-1', 'redeemedOnBillId': constant.config['billNumber'], 'eventTimeInMillis': Utils.getTime(seconds=(randValues.randomInteger(2)), milliSeconds=True), 'userDetails': EMFObject.constructUserDetailsObject(0), 'uniqueId': constant.config['uniqueId'], 'serverReqId': constant.config['serverReqId'], 'source': 'INSTORE', 'accountId': str(constant.config['programId']), } constant.config['defaultRedeemPts'] = paramDict[ 'numPointsToBeRedeemed'] if paramDict.has_key( 'numPointsToBeRedeemed') else 100 tmpDict.update(paramDict) return emf.PointsRedemptionEventData(**tmpDict)
def test_LUCI_GCD_025(self): # Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True, 'redeem_at_store' : str([self.tillId])}) LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj) couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] transNum1 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1)['transactionNumber'] time.sleep(1) self.billId = Utils.getTime(milliSeconds=True) transNum2 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2)['transactionNumber'] # coupon Search and Assertion redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber': [transNum1]}) issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]}) couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1]) redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber': [transNum2]}) issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]}) couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode2]) redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber': [transNum1, transNum2]}) issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]}) couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1, couponCode2])
def test_LUCI_RSC_002(self, description, config): couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, config) LuciHelper.queuePumpWait(self, couponSeriesId) # Issue Coupon Code couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0] resendRequest = LuciObject.resendCouponRequest({ 'storeUnitId': self.tillId, 'eventTimeInMillis': Utils.getTime(milliSeconds=True), 'couponCode': couponCode, 'userId': self.userId }) couponDetails = self.connObj.resendCoupon(resendRequest).__dict__ Assertion.constructAssertion( couponCode == couponDetails['couponCode'], 'Resend Coupon Code Actual: {} and Expected: {}'.format( couponCode, couponDetails['couponCode'])) Assertion.constructAssertion( couponDetails['ex'] == None, 'Resend Coupon No exception occurred : {}'.format( couponDetails['ex']))
def disableExistingPromotions(programId, orgId): perConnObj = LoyaltyHelper.getConnObj('pointsEngineRulesPort') prgInfoList = perConnObj.getPromotionsByProgramId(programId=programId, orgId=orgId) for pInfo in prgInfoList: if pInfo.isActive == True: pInfo.isActive = False perConnObj.createOrUpdatePromotion(pInfo, programId, orgId, 1, Utils.getTime())
def test_irisv2_message_edit_upcoming_create_plain_mobile_particulardate_to_immediate( self, campaignType, testControlType, listType, channel, messageInfo, statusCode, errorCode, errorDescription): messageDetails = CreateMessage.create(campaignType, testControlType, listType, channel, messageInfo, updateNode=True, lockNode=True) CreateMessage.assertResponse(messageDetails['RESPONSE'], 200) message_calls().waitForJobDetailsStatusToClose( messageDetails['RESPONSE']['json']['entity']['id'], 'VARIANT_CREATION') dateTime = Utils.getTime(hours=5, minutes=32, dateTimeFormat=True) messageDetails['PAYLOAD'].update( {'schedule': { 'scheduleType': 'IMMEDIATE' }}) editInfo = CreateMessage.edit( constant.config['node'][campaignType][testControlType]['CAMPAIGN'] ['ID'], messageDetails['RESPONSE']['json']['entity']['id'], messageDetails['PAYLOAD']) CreateMessage.assertResponse(editInfo['RESPONSE'], 400, expectedErrorCode=[errorCode], expectedErrorMessage=errorDescription)
def ReturnBillLineitemsEventData(paramDict={'returnLineItem': {}}): constant.config['uniqueId'] = randValues.randomString(8) tmpDict = { 'orgID': constant.config['orgId'], 'customerID': constant.config['usersInfo'][0]['userId'], 'returnBillID': constant.config['billNumber'], 'storeUnitID': constant.config['storeIds'][0], 'eventTimeInMillis': Utils.getTime(milliSeconds=True), 'uniqueId': constant.config['uniqueId'], 'serverReqId': constant.config['serverReqId'], 'returnLineItems': [EMFObject.ReturnLineItem(paramDict['returnLineItem'])], 'userDetails': EMFObject.constructUserDetailsObject(0), 'source': 'INSTORE', 'accountId': str(constant.config['programId']), } paramDict.pop('returnLineItem') tmpDict.update(paramDict) return emf.ReturnBillLineitemsEventData(**tmpDict)
def test_executeTierDowngradeForOrgAtTime(self): billingTime = Utils.getTime(days=-120, dateTimeFormat=True) txBody = { "root": { "transaction": { "amount": "6000", "billing_time": billingTime, "gross_amount": "6000" } } } txObj = InTouchAPI(Transaction.Add(body=txBody)) custObj = InTouchAPI(Customer.Get({'mobile': txObj.params['mobile']})) currentSlab = custObj.response['response']['customers']['customer'][0][ 'current_slab'] Assertion.constructAssertion( currentSlab == 'Gold', 'Current Slab Should be Gold before Tier Downgrade') firstDayofMonth = Utils.getFirstDayofMonth(milliSeconds=True) self.connObj.executeTierDowngradeForOrgAtTime(self.orgId, firstDayofMonth, True, True) custObj = InTouchAPI(Customer.Get({'mobile': txObj.params['mobile']})) currentSlab = custObj.response['response']['customers']['customer'][0][ 'current_slab'] Assertion.constructAssertion( currentSlab == 'Silver', 'Current Slab Should be Silver after Tier Downgrade')
def PointsRedemptionReversalEventData(paramDict={}): constant.config['uniqueId'] = randValues.randomString(8) tmpDict = { 'orgID': constant.config['orgId'], 'storeUnitID': constant.config['storeIds'][0], 'eventTimeInMillis': Utils.getTime(seconds=randValues.randomInteger(2), milliSeconds=True), 'userDetails': EMFObject.constructUserDetailsObject(0), 'uniqueRedemptionId': None, 'uniqueId': constant.config['uniqueId'], 'serverReqId': constant.config['serverReqId'], 'source': 'INSTORE', 'accountId': str(constant.config['programId']), 'notes': 'Auto points reversal' } tmpDict.update(paramDict) return emf.PointsRedemptionReversalEventData(**tmpDict)
def test_LUCI_GCD_016(self): # Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True, 'same_user_multiple_redeem': True, 'multiple_use': True}) LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj) couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] redeemedDate1 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1)['redemptionDate'] time.sleep(2) self.billId = Utils.getTime(milliSeconds=True) redeemedDate2 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2)['redemptionDate'] # coupon Search and Assertion redemptionFiltersObj = LuciObject.redemptionFilters({'redemptionDateStart': (redeemedDate1 - 1000),'redemptionDateEnd': (redeemedDate1 + 1000)}) redemptionFiltersObj = {'redemptionFilters': redemptionFiltersObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1]) redemptionFiltersObj = LuciObject.redemptionFilters({'redemptionDateStart': (redeemedDate2 - 1000),'redemptionDateEnd': (redeemedDate2 + 1000)}) redemptionFiltersObj = {'redemptionFilters': redemptionFiltersObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode2]) redemptionFiltersObj = LuciObject.redemptionFilters({'redemptionDateStart': (redeemedDate1 - 1000),'redemptionDateEnd': (redeemedDate2 + 1000)}) redemptionFiltersObj = {'redemptionFilters': redemptionFiltersObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1, couponCode2])
def test_LUCI_GCD_015(self): # Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) couponConfigObj.update({'allow_multiple_vouchers_per_user' : True, 'do_not_resend_existing_voucher' : True, 'same_user_multiple_redeem' : True,'multiple_use' : True}) LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj) couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0] transNum1 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1)['transactionNumber'] time.sleep(1) self.billId = Utils.getTime(milliSeconds=True) transNum2 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2)['transactionNumber'] time.sleep(1) # coupon Search and Assertion redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber' : [transNum1]}) redemptionFiltersObj = {'redemptionFilters' : redemptionFiltersObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1]) redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber' : [transNum2]}) redemptionFiltersObj = {'redemptionFilters' : redemptionFiltersObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode2]) redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber' : [transNum1,transNum2]}) redemptionFiltersObj = {'redemptionFilters' : redemptionFiltersObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1, couponCode2])
def setup_class(self): Logger.logSuiteName(str(self).split('.')[-1]) self.constructObj = LuciObject() self.userId = constant.config['usersInfo'][0]['userId'] self.tillId = constant.config['tillIds'][0] self.storeId = constant.config['storeIds'][0] self.billId = Utils.getTime(milliSeconds=True)
def disableTierDowngrade(orgId, programId): perConnObj = LoyaltyHelper.getConnObj('pointsEngineRulesPort') tierDowngrad = perConnObj.getAllStrategiesByStrategyTypeId(programId, orgId, 5) if tierDowngrad != []: sInfo = tierDowngrad[0] sInfo.propertyValues = json.dumps({"isActive":"false"}) sInfo.owner = 'LOYALTY' perConnObj.createOrUpdateStrategy(sInfo, programId, orgId, -1, Utils.getTime())
def CouponReminderDetails(couponReminderDetailsDict={}): tmpDict = { 'id': 0, 'orgId': constant.config['orgId'], 'createdBy': constant.config['adminId'], 'createdOn': Utils.getTime(milliSeconds=True) } tmpDict.update(couponReminderDetailsDict) return dracarys.CouponReminderDetails(**tmpDict)
def setup_class(self): Logger.logSuiteName(str(self).split('.')[-1]) self.constructObj = LuciObject() self.DracarysObj = DracarysObject() self.userId = constant.config['usersInfo'][0]['userId'] self.tillId = constant.config['tillIds'][0] self.userIds = [] for i in range(len(constant.config['usersInfo'])): self.userIds.append(constant.config['usersInfo'][i]['userId']) self.billId = Utils.getTime(milliSeconds=True)
def test_LUCI_RC_DC_020(self,description): #Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq={'redemption_valid_after_days' : 1, 'redemption_valid_from' : None}) LuciHelper.queuePumpWait(self, couponSeriesId) couponCode, couponDetails = LuciHelper.issueCouponAndAssertions(self, couponSeriesId) changeDate = Utils.getTime(days=-1, minutes=5,milliSeconds=True) self.connObj.changeCouponIssuedDate(couponDetails['id'], changeDate) #redeem Coupon and Assertion.constructAssertion(on) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode) LuciHelper.redemptionDBAssertion(self, couponSeriesId)
def issueCouponRequest(requestDict={}): tmpDict = { 'requestId': constant.config['requestId'], 'orgId': constant.config['orgId'], 'couponSeriesId': 0, 'storeUnitId': 0, 'userId': 0, 'eventTimeInMillis': Utils.getTime(milliSeconds=True) } tmpDict.update(requestDict) return luci.IssueCouponRequest(**tmpDict)
def pointsRedemptionAndAssertion(self,pointsToRedeem, initialRedeemedPoints, paramDict = {}): time.sleep(2) tmpDict = {'customerID' : self.customerId, 'eventTimeInMillis': Utils.getTime(seconds=(random.randint(0,9)),milliSeconds=True), 'numPointsToBeRedeemed' : pointsToRedeem} tmpDict.update(paramDict) ptsRedemptionObject = EMFObject.PointsRedemptionEventData(tmpDict) redeemPointsResponse = LoyaltyHelper.simplePropertiesParser(self.EMFConnObj.pointsRedemptionEvent(ptsRedemptionObject).__dict__) Assertion.constructAssertion(redeemPointsResponse['uniqueRedemptionId'] != None, 'Unique Redemption Id is not Empty Actual: {}'.format(redeemPointsResponse['uniqueRedemptionId'])) Assertion.constructAssertion(int(redeemPointsResponse['numPoints']) == pointsToRedeem, 'Redeemed points Actual: {} and Expected: {}'.format(redeemPointsResponse['numPoints'] , pointsToRedeem)) Assertion.constructAssertion('REDEEM' in redeemPointsResponse['instructionType'], 'REDEEM Instruction not executed in points redemptions') LoyaltyHelper.assertOnSumOfPoints(self,(initialRedeemedPoints+pointsToRedeem)) return redeemPointsResponse
def test_LUCI_RSD_007(self, description, couponConfig): couponSeriesId = LuciHelper.saveCouponConfigAndAssertions( self, couponConfig)[1] couponCode, couponDetails = LuciHelper.issueCouponAndAssertions( self, couponSeriesId) changeDate = Utils.getTime(days=-1, hours=-2, milliSeconds=True) self.connObj.changeCouponIssuedDate(couponDetails['id'], changeDate) LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, no_issued=1) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode) LuciHelper.redemptionDBAssertion(self, couponSeriesId, numRedeemed=1)
def test_LUCI_GCD_011_sanity(self): #Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) #Checking Coupon Created Count LuciHelper.queuePumpWait(self,couponSeriesId) createdCouponCount = LuciDBHelper.getCouponsCreated_Count(couponSeriesId) Assertion.constructAssertion(createdCouponCount != 0, 'Coupon Code Pumped to Queue') # change the coupon config couponConfigObj.update({'do_not_resend_existing_voucher' : True, 'allow_multiple_vouchers_per_user' : True}) LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj) transactionId1 = Utils.getTime(milliSeconds=True); time.sleep(1) transactionId2 = Utils.getTime(milliSeconds=True); #Construct Obj and Issue Coupon Code issueCouponObj ={'couponSeriesRequired': True, 'billId' : transactionId1} couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId,issueCouponObj)[0] #Change Issue obj billId and Issue one more coupon issueCouponObj = {'couponSeriesRequired': True, 'billId': transactionId2} couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId, issueCouponObj)[0] # Added Issue Filter & Search Coupon 1 issualFilterObj = LuciObject.issualFilters({'transactionId' : [transactionId1]}) issualFilterObj = {'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId],issualFilterObj ,[couponCode1]) #Added Issue Filter & Search Coupon 2 issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId2]}) issualFilterObj = {'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], issualFilterObj, [couponCode2]) # Added Issue Filter & Search Coupon 3 issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId1 , transactionId2]}) issualFilterObj = {'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId],issualFilterObj, [couponCode1,couponCode2])
def orgDefaults(requestObj={}): tmpDict = { 'orgId': constant.config['orgId'], 'smsTemplate': 'Org Default SMS Reminder {{voucher}} ', 'alphaNumeric': True, 'shortCodeLength': 0, 'randomCodeLength': 8, 'syncToInstore': False, 'updatedBy': constant.config['adminId'], 'updatedOn': Utils.getTime(milliSeconds=True) } tmpDict.update(requestObj) return luci.OrgDefaults(**tmpDict)
def test_irisV2_editMessage_afterCampaign_expires(self, description, campaignType, testControlType, channel, messageInfo, statusCode, errorCode, errorDescription): messageDetails = CreateMessage.create(campaignType, testControlType, 'LOYALTY', channel, messageInfo, updateNode=True) campaignInfo = constant.config['node'][campaignType][testControlType]['CAMPAIGN'] CreateMessage.assertResponse(messageDetails['RESPONSE'], 200) editInfo = {'endDate': Utils.getTime(minutes=1, milliSeconds=True)} editInfo = CreateCampaign.edit(campaignInfo, editInfo) time.sleep(61) editInfo = CreateMessage.edit(constant.config['node'][campaignType][testControlType]['CAMPAIGN']['ID'], messageDetails['RESPONSE']['json']['entity']['id'], messageDetails['PAYLOAD']) CreateMessage.assertResponse(editInfo['RESPONSE'], 400, expectedErrorCode=[errorCode], expectedErrorMessage=errorDescription)
def test_LUCI_GCD_024(self): # Save Coupon Config couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self) couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True}) LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj) transactionId1 = Utils.getTime(milliSeconds=True); time.sleep(2) transactionId2 = Utils.getTime(milliSeconds=True); # Construct Obj and Issue Coupon Code issueCouponObj = {'couponSeriesRequired': True, 'billId': transactionId1} couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId, issueCouponObj)[0] # Change Issue obj billId and Issue one more coupon issueCouponObj = {'couponSeriesRequired': True, 'billId': transactionId2} couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId, issueCouponObj)[0] tempBill1 = self.billId LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1) tempBill2 = self.billId = Utils.getTime(milliSeconds=True) LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2) # coupon Search and Assertion redemptionFiltersObj = LuciObject.redemptionFilters({'transactionId' : [tempBill1]}) issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId1]}) couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1]) redemptionFiltersObj = LuciObject.redemptionFilters({'transactionId' : [tempBill2]}) issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId2]}) couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode2]) redemptionFiltersObj = LuciObject.redemptionFilters({'transactionId' : [tempBill1,tempBill2]}) issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId1, transactionId2]}) couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj} LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1, couponCode2])
def constructSchedule(scheduleType): if scheduleType['type'] == 'IMMEDIATE': return {'scheduleType': 'IMMEDIATE'} elif scheduleType['type'] == 'PARTICULARDATE': return { 'scheduleType': 'PARTICULAR_DATE', 'scheduledDate': Utils.getTime(minutes=4, seconds=30, milliSeconds=True) } elif scheduleType['type'] == 'RECURRING': defaultScheduleTimer = Utils.getTime(hours=5, minutes=35, dateTimeFormat=True) return { 'scheduleType': 'RECURRING', 'hour': scheduleType['hour'] if 'hour' in scheduleType else int( defaultScheduleTimer[11:13]), 'minute': scheduleType['minute'] if 'minute' in scheduleType else int( defaultScheduleTimer[14:16]), 'startDate': scheduleType['startDate'] if 'startDate' in scheduleType else Utils.getTime(seconds=90, milliSeconds=True), 'endDate': scheduleType['endDate'] if 'endDate' in scheduleType else Utils.getTime(hours=20, milliSeconds=True), 'repeatType': scheduleType['repeatType'] if 'repeatType' in scheduleType else 'DAILY', 'repeatOn': scheduleType['repeatOn'] if 'repeatOn' in scheduleType else [1] } else: raise Exception('NotSupportedScheduleTypeException:{}'.format( scheduleType['type']))
def setup_class(self): Logger.logSuiteName(str(self).split('.')[-1]) self.connObj = LuciHelper.getConnObj(newConnection=True) self.constructObj = LuciObject() self.userId = constant.config['usersInfo'][0]['userId'] self.tillId = constant.config['tillIds'][0] self.storeId = constant.config['storeIds'][0] self.billId = Utils.getTime(milliSeconds=True) self.couponConfig1, self.couponSeriesId1 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN', 'created' : Utils.getTime(seconds=0, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8}) self.couponConfig2, self.couponSeriesId2 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=1, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8}) self.couponConfig3, self.couponSeriesId3 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=2, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8}) self.couponConfig4, self.couponSeriesId4 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=3, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8}) self.couponConfig5, self.couponSeriesId5 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=4, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8})
def test_irisv2_message_execute_flow_precheck_particularDate_passed_with2MinsInterval( self, campaignType, testControlType, listType, channel, messageInfo): precheckError = { 'remind': { 'status': 'TEMPORARY_FAILURE', 'errorDescription': 'CAMPAIGN_NOT_AUTHORIZED' } } scheduleType = { 'scheduleType': 'PARTICULAR_DATE', 'scheduledDate': Utils.getTime(minutes=2, seconds=00, milliSeconds=True) } messageDetails = CreateMessage.create(campaignType, testControlType, listType, channel, messageInfo, scheduleType=scheduleType, updateNode=True, lockNode=True) CreateMessage.assertResponse(messageDetails['RESPONSE'], 200) PreCheckDBValidation( constant.config['node'][campaignType][testControlType]['CAMPAIGN'] ['ID'], messageDetails['RESPONSE']['json']['entity']['id'], messageInfo['scheduleType']['type'], ['REMINDED', 'OPENED'], executeCheck=False, variantCheck=False, precheck=precheckError['remind']).validateMessageFlow() approveRespone = AuthorizeMessage.approve( campaignType, testControlType, listType, channel, messageInfo, messageCreateResponse=messageDetails) AuthorizeMessage.assertResponse(approveRespone, 200) Precheck_calls().waitForJobTypeUpdate( constant.config['node'][campaignType][testControlType]['CAMPAIGN'] ['ID'], messageDetails['RESPONSE']['json']['entity']['id'], 'REMIND', 'PRECHECK', 'SUCCESS') PreCheckDBValidation( constant.config['node'][campaignType][testControlType]['CAMPAIGN'] ['ID'], messageDetails['RESPONSE']['json']['entity']['id'], messageInfo['scheduleType']['type'], ['REMINDED', 'OPENED']).validateMessageFlow()