def test_veneno_replyMessage_CUSTOM_Sanity(self, description, couponConfig,
                                            skippedReason, configChange):
     couponConfig.update({'description': description})
     self.voucherId = VenenoHelper.createCouponLuci(self, couponConfig)
     communicationDetailsId, communicationDetailBucketId, communicationDetailExpectedCount = VenenoHelper.messageAuthorize(
         self, skippedError=skippedReason, isSkippedMessage=True)
     VenenoHelper.couponConfigChange(self, configChange)
     time.sleep(2)
     self.commDetailsId = communicationDetailsId
     authorize.dbAssertionInSkippedReplyTables(communicationDetailsId)
     campaignMessage.replyMessage(self)
     time.sleep(10)
     campaignReplyStats = dbCallsAuthorize.getVenenoReplyStats(
         communicationDetailsId)
     Assertion.constructAssertion(
         len(campaignReplyStats) != 0,
         'Campaign Reply Stats update status {}'.format(
             len(campaignReplyStats)))
     authorize.assertUserPresenceInNsAdminTable(
         communicationDetailsId,
         communicationDetailBucketId,
         int(communicationDetailExpectedCount),
         verify=False,
         waitForInboxMsg=True)
     communcationDetailsDict = dbCallsAuthorize.getCommunicationDetailsWithId(
         communicationDetailsId)
     Assertion.constructAssertion(
         communcationDetailsDict['state'] == 'REPLAYED',
         'Communication Details MessageId state is Actual: {} and Expected: {}'
         .format(communcationDetailsDict['state'], 'REPLAYED'))
     Assertion.constructAssertion(
         communcationDetailsDict['expected_delivery_count'] == int(
             communicationDetailExpectedCount),
         'Communication Details Expected Delivery count Actual: {} and Expected: {}'
         .format(communcationDetailsDict['expected_delivery_count'],
                 int(communicationDetailExpectedCount)))
     Assertion.constructAssertion(
         communcationDetailsDict['message_queue_id'] != 0,
         'Communication Details Message Queue Id is not 0 Actual: {}'.
         format(communcationDetailsDict['message_queue_id']))
    def setup_class(self):
        self.Details = {}
        self.listOfReplyMessage = constant.listOfReplyMessage
        self.first = True
        self.testConfig = constant.testConfig
        self.testControlType = 'custom'
        campaignDict = VenenoHelper.preRequisitesForVenenoReply(
            testControlType=self.testControlType)
        self.campaignId = campaignDict['campaignId']
        constant.config['campaignId'] = self.campaignId
        self.listId = campaignDict['listId']
        self.strategy = campaignDict['strategy']
        self.programeId = campaignDict['programeId']
        self.allocationStrategyId = campaignDict['allocationStrategyId']
        self.expiryStrategyId = campaignDict['expiryStrategyId']
        self.bucketId = campaignDict['bucketId']
        self.groupVersionResult = campaignDict['groupVersionResult']
        for replyType, errorConfig in zip(self.listOfReplyMessage,
                                          self.testConfig):

            errorConfig[1].update({'description': replyType})
            self.voucherId = VenenoHelper.createCouponLuci(
                self, errorConfig[1])
            self.Details[replyType] = {'voucherId': self.voucherId}
            if self.first:
                self.mutualIds = '[' + str(self.voucherId) + ']'
                self.first = False
            if replyType == 'COUPON_PRESENT_IN_MUTUAL_EXCLUSIVE_SERIES':
                errorConfig[1].update(
                    {'mutual_exclusive_series_ids': self.mutualIds})
            if replyType == 'COUPON_EXPIRED':
                errorConfig[1].update({
                    'fixedExpiryDate':
                    Utils.getTime(days=-1, milliSeconds=True)
                })
            Logger.log('Campaign Details : ', errorConfig[0], errorConfig[1])
            VenenoHelper.constructReplyCampaignDetails(self, replyType,
                                                       errorConfig[0],
                                                       errorConfig[1])