def test_irisv2_message_execute_loyalty_mobile_coupon_recurring_ProdSanity( self, campaignType, testControlType, listType, channel, messageInfo): campaignId = CreateCampaign.create(campaignType, testControlType, updateNode=True, lockNode=True)['ID'] couponSeriesId = CreateMessage.getCouponSeriesId(campaignId) approveRespone = AuthorizeMessage.approve( campaignType, testControlType, listType, channel, messageInfo, campaignId=campaignId, couponSeriesId=couponSeriesId) AuthorizeMessage.assertResponse(approveRespone, 200) campaignId = campaignId response = constant.config['node'][campaignType][testControlType][ 'LIST'][listType][channel]['MESSAGE'][messageInfo['scheduleType'][ 'type']][messageInfo['offerType']]['RESPONSE'] payload = constant.config['node'][campaignType][testControlType][ 'LIST'][listType][channel]['MESSAGE'][messageInfo['scheduleType'][ 'type']][messageInfo['offerType']]['PAYLOAD'] AuthorizeMessageDBAssertion(campaignId, response, payload, testControlType).check()
def createMessageContent(campaignType, testControlType, numberOfCustomTag, channel=None, messageBody=None, couponEnabled=False, pointsEnabled=False): messageBodyType = 'plain' if couponEnabled: messageBodyType = 'coupon' if pointsEnabled: messageBodyType = 'points' messageContent = dict() messageContent.update({ 'mesage_content_1': { 'channel': 'SMS' if channel is None else channel, 'messageBody': constant.irisMessage[channel.lower()][ messageBodyType] if messageBody is None else messageBody, } }) if channel == 'EMAIL': messageContent['mesage_content_1'].update({ 'emailSubject': 'TestAndPreviewAutomation', 'emailBody': constant.irisMessage[channel.lower()][ messageBodyType] if messageBody is None else messageBody }) if couponEnabled: messageContent['mesage_content_1'].update({ 'offers': [{ 'type': 'COUPON', 'couponSeriesId': CreateMessage.getCouponSeriesId( constant.config['node'][campaignType][testControlType]['CAMPAIGN']['ID']) }], }) if pointsEnabled: pointsIds = CreateMessage.getStrategyIds() messageContent['mesage_content_1'].update({ 'offers': [{ 'type': 'POINTS', 'programId': pointsIds['programeId'], 'allocationStrategyId': pointsIds['allocationStrategyId'], 'expirationStrategyId': pointsIds['expirationStrategyId'] }], }) if channel == 'EMAIL': messageContent['mesage_content_1'].pop('messageBody') if numberOfCustomTag >0: if 'messageBody' in messageContent['mesage_content_1']: messageContent['mesage_content_1'].update({'messageBody': TestPreview.getCustomTagsAppendedToBody( messageContent['mesage_content_1']['messageBody'], numberOfCustomTag)}) if 'emailBody' in messageContent['mesage_content_1']: messageContent['mesage_content_1'].update({'emailBody': TestPreview.getCustomTagsAppendedToBody( messageContent['mesage_content_1']['emailBody'], numberOfCustomTag)}) return messageContent
def test_irisv2_message_execute_upload_push_immediate_coupon_live_pushThread( self, campaignType, testControlType, listType, channel, messageInfo): try: actualOrgId = IrisHelper.updateOrgId( constant.config['mobilepush']['orgId']) actualOrgName = IrisHelper.updateOrgName( constant.config['mobilepush']['orgName']) campaignInfo = CreateCampaign.create(campaignType, testControlType, updateNode=True, lockNode=True) couponSeriesId = CreateMessage.getCouponSeriesId( campaignInfo['ID']) approveRespone = AuthorizeMessage.approve( campaignType, testControlType, listType, channel, messageInfo, campaignId=campaignInfo['ID'], couponSeriesId=couponSeriesId) AuthorizeMessage.assertResponse(approveRespone, 200) campaignId = campaignInfo['ID'] response = constant.config['node'][campaignType][testControlType][ 'LIST'][listType][channel]['MESSAGE'][ messageInfo['scheduleType']['type']][ messageInfo['offerType']]['RESPONSE'] payload = constant.config['node'][campaignType][testControlType][ 'LIST'][listType][channel]['MESSAGE'][ messageInfo['scheduleType']['type']][ messageInfo['offerType']]['PAYLOAD'] AuthorizeMessageDBAssertion(campaignId, response, payload, testControlType).check() finally: IrisHelper.updateOrgId(actualOrgId) IrisHelper.updateOrgName(actualOrgName)