Пример #1
0
 def test_veneno_rateLimit_MonthlyByPass(self, listType):
     VenenoHelper.setupStrategy(daily=3,
                                weekly=2,
                                monthly=1,
                                channel='PUSH')
     VenenoHelper.updateWindowValueToByPassStrategy(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'],
         'MONTHLY',
         channel='PUSH')
     self.listId = self.testObjectForRateLimit['list'][listType][
         'groupDetails']['id']
     cdDetailsBody = {
         'campaignId':
         self.testObjectForRateLimit['campaign']['id'],
         'communicationType':
         'PUSH',
         'subject':
         'Automation Generated Body',
         'body':
         '{"templateData":{"CHANNELACCOUNTNAME":{"luid":"{{luid}}","cuid":"{{cuid}}","communicationId":"{{communicationId}}","title":"asas","message":"asasas","expandableDetails":{"style":"BIG_TEXT","message":"asasas"},"custom":[]}}}'
         .replace('CHANNELACCOUNTNAME', self.account),
         'recipientListId':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['id'],
         'overallRecipientCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'expectedDeliveryCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'groupName':
         self.testObjectForRateLimit['list'][listType]['groupDetails']
         ['group_label']
     }
     communicationDetailObject = VenenoObject.communicationDetail(
         cdDetailsBody)
     communicationId = self.connObj.addMessageForRecipients(
         communicationDetailObject)
     VenenoDBAssertion(cdDetailsBody['campaignId'],
                       cdDetailsBody['communicationType'], communicationId,
                       cdDetailsBody['overallRecipientCount'],
                       cdDetailsBody['recipientListId'],
                       cdDetailsBody['subject']).check()
     authorize.assertUserPresenceInNsAdminTable(
         communicationId,
         VenenoHelper.getCommunicationBucketId(communicationId),
         int(
             json.loads(
                 self.testObjectForRateLimit['list'][listType]
                 ['groupVersionDetails']['TEST']['params'])['test_count']),
         verify=False)
     authorize.dbAssertRateLimitStats(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'], {
             'DAILY': 3,
             'WEEKLY': 2,
             'MONTHLY': 1
         },
         channel='PUSH')
 def test_veneno_rateLimit_reconfig_allStrategySatisified_StatsUpdateCheck(self, listType):
     VenenoHelper.setupStrategy(daily=3, weekly=3, monthly=3)
     self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id']
     authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType)
     communicationDetailId ,communicationDetailBucketId ,communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId'])
     VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom').check()
     authorize.assertUserPresenceInNsAdminTable(communicationDetailId , communicationDetailBucketId, int(communicationDetailExpectedCount))
     authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':3, 'WEEKLY':3, 'MONTHLY':3})
 def test_veneno_rateLimit_dailyWeeklyMonthlyLimitExceed(self, listType):
     VenenoHelper.setupStrategy(daily=1, weekly=1, monthly=1)
     self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id']
     authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType)
     authorize.assertAuthorize(authorizeResult['authorizeResponse'], 200)
     communicationDetailId ,communicationDetailBucketId, communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId'])
     VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom',skippedReasons=['rate limit crossed for user']).check()
     authorize.assertUserPresenceInSkippedTable(communicationDetailId, communicationDetailBucketId, constant.config['skipped_errors']['RATE_LIMIT_ERROR'], 'rate limit crossed for user')
     authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':1, 'WEEKLY':1, 'MONTHLY':1})
Пример #4
0
 def test_veneno_rateLimit_MonthlyByPass(self, listType):
     VenenoHelper.setupStrategy(daily=3,
                                weekly=2,
                                monthly=1,
                                channel='EMAIL')
     VenenoHelper.updateWindowValueToByPassStrategy(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'],
         'MONTHLY',
         channel='EMAIL')
     self.listId = self.testObjectForRateLimit['list'][listType][
         'groupDetails']['id']
     cdDetailsBody = {
         'campaignId':
         self.campaignId,
         'communicationType':
         'EMAIL',
         'subject':
         'Automation Generated Body {{unsubscribe}}',
         'recipientListId':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['id'],
         'overallRecipientCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'expectedDeliveryCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'groupName':
         self.testObjectForRateLimit['list'][listType]['groupDetails']
         ['group_label']
     }
     communicationDetailObject = VenenoObject.communicationDetail(
         cdDetailsBody)
     communicationId = self.connObj.addMessageForRecipients(
         communicationDetailObject)
     authorize.assertUserPresenceInNsAdminTable(
         communicationId,
         VenenoHelper.getCommunicationBucketId(communicationId),
         int(
             json.loads(
                 self.testObjectForRateLimit['list'][listType]
                 ['groupVersionDetails']['TEST']['params'])['test_count']),
         verify=False,
         channel='EMAIL')
     authorize.dbAssertRateLimitStats(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'], {
             'DAILY': 3,
             'WEEKLY': 2,
             'MONTHLY': 1
         },
         channel='EMAIL')
Пример #5
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     self.actualOrgId = construct.updateOrgId(
         constant.config['wechat']['orgId'])
     self.actualOrgName = construct.updateOrgName(
         constant.config['wechat']['orgName'])
     VenenoHelper.configRateLimit(enable=True, channel='WECHAT')
     VenenoHelper.setupStrategy(daily=1,
                                weekly=2,
                                monthly=3,
                                channel='WECHAT')
     self.testObjectForRateLimit = VenenoHelper.preRequisitesForVenenoRateLimit(
         'WECHAT')
     self.campaignId = self.testObjectForRateLimit['campaign']['id']
Пример #6
0
 def test_veneno_rateLimit_monthlyLimitExceed(self, listType):
     VenenoHelper.setupStrategy(daily=2,
                                weekly=2,
                                monthly=1,
                                channel='PUSH')
     self.listId = self.testObjectForRateLimit['list'][listType][
         'groupDetails']['id']
     cdDetailsBody = {
         'campaignId':
         self.testObjectForRateLimit['campaign']['id'],
         'communicationType':
         'PUSH',
         'subject':
         'Automation Generated Body',
         'body':
         '{"templateData":{"CHANNELACCOUNTNAME":{"luid":"{{luid}}","cuid":"{{cuid}}","communicationId":"{{communicationId}}","title":"asas","message":"asasas","expandableDetails":{"style":"BIG_TEXT","message":"asasas"},"custom":[]}}}'
         .replace('CHANNELACCOUNTNAME', self.account),
         'recipientListId':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['id'],
         'overallRecipientCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'expectedDeliveryCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'groupName':
         self.testObjectForRateLimit['list'][listType]['groupDetails']
         ['group_label']
     }
     communicationDetailObject = VenenoObject.communicationDetail(
         cdDetailsBody)
     communicationId = self.connObj.addMessageForRecipients(
         communicationDetailObject)
     communicationDetailBucketId = VenenoHelper.getCommunicationBucketId(
         communicationId)
     authorize.assertUserPresenceInSkippedTable(
         communicationId,
         VenenoHelper.getCommunicationBucketId(communicationId),
         constant.config['skipped_errors']['RATE_LIMIT_ERROR'],
         'rate limit crossed for user')
     authorize.dbAssertRateLimitStats(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'], {
             'DAILY': 1,
             'WEEKLY': 1,
             'MONTHLY': 1
         },
         channel='PUSH')
Пример #7
0
 def setBaseState():
     module = constant.config['module']
     if module == 'nsadmin':
         NSAdminHelper.checkCommServerConn()
     if module == 'iris':
         NSAdminHelper.checkCommServerConn(ignoreConnectionError=True)
         LuciHelper.checkLuciConn(ignoreConnectionError=False)
     if module == 'irisv2':
         LuciHelper.checkLuciConn(ignoreConnectionError=True)
         ReonHelper.checkReonConnection(ignoreConnectionError=True)
         NSAdminHelper.checkCommServerConn()
         CampaignShardHelper.checkCampaignShardConnection()
     if module == 'luci':
         LuciHelper.loginAndGetCookies()
         LuciHelper.checkLuciConn()
         DracarysHelper.checkDracarysConn()
         LuciHelper.setBaseDetails()
     if module == 'veneno':
         LuciHelper.checkLuciConn(ignoreConnectionError=True)
         LuciDBHelper.getAdminUserId()
         VenenoHelper.checkVenenoServerConnection()
         NSAdminHelper.checkCommServerConn(ignoreConnectionError=True)
         CampaignShardHelper.checkCampaignShardConnection()
     if module == 'campaign_shard':
         CampaignShardHelper.checkCampaignShardConnection()
     if module == 'darknight':
         DarknightHelper.checkDarknightConn()
     if module == 'campaignsui':
         NSAdminHelper.checkCommServerConn(ignoreConnectionError=True)
         TemporalHelper.checkTemporalServerConnection(ignoreConnectionError=True)
         try:
             status, version = ChromeDriverManager.checkChromeDriverCompatibility()
             if not status:
                 ChromeDriverManager.downloadChromeDriver(version)
         except:
             Logger.log(traceback.format_exc())
     if module == 'emf' or module == 'peb':
         LoyaltyHelper.checkEMFConn()
         PEBHelper.checkPEBConn()
     if module == 'peb':
         PEBHelper.checkPEBConn()
     if module == 'social':
         SocialHelper.checkSocialConn()
         VenenoHelper.checkVenenoServerConnection()
         LuciHelper.checkLuciConn(ignoreConnectionError=True)
         LuciDBHelper.getAdminUserId()
         DracarysHelper.checkDracarysConn(ignoreConnectionError=True)
         LuciHelper.loginAndGetCookies()
         LuciHelper.setBaseDetails()
Пример #8
0
 def test_veneno_rateLimit_dailyLimitExceed(self, listType):
     self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id']
     cdDetailsBody = {
          'campaignId':self.campaignId,
          'communicationType':'EMAIL',
          'subject':'Automation Generated Body {{unsubscribe}}',
          'recipientListId':self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['id'],
          'overallRecipientCount':self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['customer_count'],
          'expectedDeliveryCount':self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['customer_count'],
          'groupName':self.testObjectForRateLimit['list'][listType]['groupDetails']['group_label']
         }
     communicationDetailObject = VenenoObject.communicationDetail(cdDetailsBody)
     communicationId = self.connObj.addMessageForRecipients(communicationDetailObject)
     communicationDetailBucketId = VenenoHelper.getCommunicationBucketId(communicationId)
     authorize.assertUserPresenceInSkippedTable(communicationId , VenenoHelper.getCommunicationBucketId(communicationId), constant.config['skipped_errors']['RATE_LIMIT_ERROR'], 'rate limit crossed for user')
     authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':1, 'WEEKLY':1, 'MONTHLY':1}, channel='EMAIL')
Пример #9
0
 def createMessageForThriftHelp(campaignId, groupVersionid, numberOfUsers,
                                groupName):
     connObj = VenenoHelper.getConnObj(newConnection=True)
     cdDetailsBody = {
         'campaignId': campaignId,
         'targetType': 'SOCIAL',
         'communicationType': 'FACEBOOK',
         'subject': '',
         'recipientListId': groupVersionid,
         'overallRecipientCount': numberOfUsers,
         'expectedDeliveryCount': numberOfUsers,
         'groupName': groupName
     }
     extraParams = {
         'voucher_series': -1,
         'default_argument': {
             "entity_id": -1,
             "is_loyalty_checkbox_enabled": "0",
             "voucher_series_id": "-1",
             "daily_budget": 1000000
         }
     }
     communicationDetailObject = VenenoObject.communicationDetail(
         cdDetailsBody, extraParams=extraParams)
     communicationId = connObj.addMessageForRecipients(
         communicationDetailObject)
     return communicationId
Пример #10
0
 def est_venenoThrift_inboxUser_WeChat_Sanity(self):
     actualOrgId = construct.updateOrgId(constant.config['wechat']['orgId'])
     actualOrgName = construct.updateOrgName(constant.config['wechat']['orgName'])
     try:
         details = VenenoHelper.preRequisitesForVenenoWechat(testControlType='skip')
         campaignMessage.getWeCRMTemplates()
         subject = {
             "template_id" : unicodedata.normalize('NFKD', constant.config['templateId']).encode('ascii', 'ignore'),
             "touser" : "{{wechat_open_id}}",
             "OriginalId" : constant.config['wechat']['OriginalId'],
             "Title" : "",
             "BrandId" : "f",
             "url" : "http://we.capillarytech-cn.com/web?appid=wxc7bf989decc7e35b&redirect_uri=http://somelink.com/someword?nowAParam=firstParam&second=second.Param&response_type=code&scope=snsapi_base&state=STATE",
             "TopColor" : "#000000",
             "data" : {"productType": {"value": "HakeemProduct", "color": "#00000"}, "name": {"value": "Hakeem {{first_name}} Lukka", "color": "#00000"}, "number": {"value": "898767 skdjnjn", "color": "#00000"}, "expDate": {"value": "look down", "color": "#00000"}, "remark": { "value": "Look up", "color": "#00000"}}
         }
         cdDetailsBody = {
              'campaignId':details['campaignId'],
              'communicationType':'WECHAT',
              'subject': str(subject),
              'body': 'Thrift Created Automation Wechat Body',
              'recipientListId':details['groupVersionResult']['TEST']['id'],
              'overallRecipientCount':details['groupVersionResult']['TEST']['customer_count'],
              'expectedDeliveryCount':details['groupVersionResult']['TEST']['customer_count'],
              'groupName':details['groupName']
             }
         communicationDetailObject = VenenoObject.communicationDetail(cdDetailsBody)
         communicationId = self.connObj.addMessageForRecipients(communicationDetailObject)
         VenenoDBAssertion(cdDetailsBody['campaignId'], cdDetailsBody['communicationType'], communicationId, cdDetailsBody['overallRecipientCount'], cdDetailsBody['recipientListId'], cdDetailsBody['subject'], testControlType='skip', skippedReasons=['Captured OpenId for user seems to be unsubscribed']).check()
     except Exception, exp:
         raise Exception('Wechat Case Failed due to :{}'.format(exp))
 def test_veneno_rateLimitsss_allStrategySatisified_sms_sanity(self, listType):
     self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id']
     authorizeResult = VenenoHelper.authorizeForRateLimit(self, listType)
     authorize.assertAuthorize(authorizeResult['authorizeResponse'], 200)
     communicationDetailId ,communicationDetailBucketId ,communicationDetailExpectedCount=authorize.assertMessageQueueAndGetCommunicationDetailsForReferenceMessageQueueId(self.campaignId,authorizeResult['groupVersionResult']['TEST']['id'],authorizeResult['messageId'])
     VenenoDBAssertion(self.campaignId, 'SMS', communicationDetailId, authorizeResult['groupVersionResult']['TEST']['customer_count'], authorizeResult['groupVersionResult']['TEST']['id'], authorizeResult['payload']['message'],testControlType='custom').check()
     authorize.assertUserPresenceInNsAdminTable(communicationDetailId , communicationDetailBucketId, int(communicationDetailExpectedCount))
     authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':1, 'WEEKLY':1, 'MONTHLY':1})
Пример #12
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     VenenoHelper.configRateLimit(enable=True, channel='EMAIL')
     VenenoHelper.setupStrategy(daily=1, weekly=2, monthly=3, channel='EMAIL')
     self.testObjectForRateLimit = VenenoHelper.preRequisitesForVenenoRateLimit('email',testControl='custom')
     self.campaignId = self.testObjectForRateLimit['campaign']['id']
     VenenoHelper.updateEmailStatus(self.testObjectForRateLimit['list'])
Пример #13
0
 def test_veneno_replyMessage_CUSTOM_allErrorTypes(self, description,
                                                   changeCouponConfig):
     Logger.log(self.Details[description])
     if description == 'COUPON_EXPIRED':
         changeCouponConfig.update(
             {'fixedExpiryDate': Utils.getTime(days=2, milliSeconds=True)})
     self.voucherId = self.Details[description]['voucherId']
     self.commDetailsId = self.Details[description][
         'communicationDetailsId']
     VenenoHelper.couponConfigChange(self, changeCouponConfig)
     time.sleep(70)
     authorize.dbAssertionInSkippedReplyTables(self.commDetailsId)
     campaignMessage.replyMessage(self)
     time.sleep(10)
     campaignReplyStats = dbCallsAuthorize.getVenenoReplyStats(
         self.Details[description]['communicationDetailsId'])
     Assertion.constructAssertion(
         len(campaignReplyStats) != 0,
         'Campaign Reply Stats update status {}'.format(
             len(campaignReplyStats)))
     authorize.assertUserPresenceInNsAdminTable(
         self.Details[description]['communicationDetailsId'],
         self.Details[description]['communicationDetailBucketId'],
         int(self.Details[description]['communicationDetailExpectedCount']),
         verify=False,
         waitForInboxMsg=True)
     communcationDetailsDict = dbCallsAuthorize.getCommunicationDetailsWithId(
         self.Details[description]['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(
             self.Details[description]['communicationDetailExpectedCount']),
         'Communication Details Expected Delivery count Actual: {} and Expected: {}'
         .format(
             communcationDetailsDict['expected_delivery_count'],
             int(self.Details[description]
                 ['communicationDetailExpectedCount'])))
     Assertion.constructAssertion(
         communcationDetailsDict['message_queue_id'] != 0,
         'Communication Details Message Queue Id is not 0 Actual: {}'.
         format(communcationDetailsDict['message_queue_id']))
Пример #14
0
 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']))
Пример #15
0
    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])
Пример #16
0
    def communicationDetail(messageDetails={}, extraParams={}):
        tmpDict = {
            'orgId': constant.config['orgId'],
            'guid': Utils.generateGUID(),
            'subject': 'Veneno Thrift Automation',
            'body': 'Thirft Created Automation Test Body {{optout}}',
            'priority': 2,
            'defaultArguments': '',
            'messageProperties': '',
            'communicationType': 'EMAIL',
            'targetType': 'GROUPED',
            'message_queue_id': 0,
            'receivedTime': str(Utils.getTime(milliSeconds=True)),
            'lastUpdatedBy': int(constant.config['userId'])
        }
        messageExtraUpdate = {}
        defaultExtraParam = {}

        if extraParams != {}:
            if 'voucher_series' in extraParams:
                messageExtraUpdate.update(
                    {'voucher_series': extraParams['voucher_series']})
            if 'default_argument' in extraParams:
                defaultExtraParam.update(extraParams['default_argument'])

        tmpDict.update(messageDetails)
        venObj = VenenoObject()
        tmpDict['defaultArguments'] = VenenoHelper.getDefaultArguments(
            channel=tmpDict['communicationType'],
            fieldsToUpdate=defaultExtraParam)
        tmpDict['messageProperties'] = VenenoHelper.getMessageProperties(
            channel=tmpDict['communicationType'],
            fieldsToUpdate=messageExtraUpdate)
        tmpDict['communicationType'] = venObj.CommunicationType[
            tmpDict['communicationType']]
        tmpDict['targetType'] = venObj.TargetType[tmpDict['targetType']]
        return veneno.CommunicationDetail(**tmpDict)
Пример #17
0
 def test_veneno_rateLimit_allStrategySatisfied_email_sanity(self, listType):
     self.listId = self.testObjectForRateLimit['list'][listType]['groupDetails']['id']
     cdDetailsBody = {
          'campaignId':self.campaignId,
          'communicationType':'EMAIL',
          'subject':'Automation Generated Body {{unsubscribe}}',
          'recipientListId':self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['id'],
          'overallRecipientCount':self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['customer_count'],
          'expectedDeliveryCount':self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['customer_count'],
          'groupName':self.testObjectForRateLimit['list'][listType]['groupDetails']['group_label']
         }
     communicationDetailObject = VenenoObject.communicationDetail(cdDetailsBody)
     communicationId = self.connObj.addMessageForRecipients(communicationDetailObject)
     authorize.assertUserPresenceInNsAdminTable(communicationId , VenenoHelper.getCommunicationBucketId(communicationId), int(json.loads(self.testObjectForRateLimit['list'][listType]['groupVersionDetails']['TEST']['params'])['test_count']), testControlType='custom', verify=False,groupVersionId=cdDetailsBody['recipientListId'],channel='EMAIL')
     authorize.dbAssertRateLimitStats(self.testObjectForRateLimit['list'][listType]['campaignGroupRecipients']['TEST'], {'DAILY':1, 'WEEKLY':1, 'MONTHLY':1}, channel='EMAIL')
Пример #18
0
 def test_wechat_UI_channel_Sanity(self, request):
     try:
         details = VenenoHelper.preRequisitesForVenenoWechat()
         self.createCampaignPage.goToCampaignSection()
         self.createCampaignPage.openCampaignWithCampaignName(details['campaignName'])
         self.createCampaignPage.goToMessagePage('wechat')
         self.messagePage.chooseRecipient(details['groupName'])
         self.messagePage.attachIncentive('nodeal')
         self.messagePage.customizeContent(templateName='',channel='wechat')
         self.messagePage.deliverySetting()
         self.createCampaignPage.authorizePresentCampaignOnPage()
         self.messagePage.verifyAuthorizeCampaign(details['campaignId'], details['groupVersionResult']['TEST']['id'])
     except Exception,exp:
         self.getScreenshot(request.node.name)
         Assertion.constructAssertion(False, exp)
Пример #19
0
 def test_venenoThrift_inboxUser_Line_Sanity(self):
     actualOrgId = construct.updateOrgId(constant.config['line']['orgId'])
     actualOrgName = construct.updateOrgName(constant.config['line']['orgName'])
     try:
         details = VenenoHelper.preRequisitesForVenenoLine(testControlType='skip')
         cdDetailsBody = {
              'campaignId':details['campaignId'],
              'communicationType':'LINE',
              'subject':'{"to":"{{line_id}}","messages":[{"type":"text","text":"Automated Call {{user_id_b64}}"}]}',
              'body':'',
              'recipientListId':details['groupVersionResult']['TEST']['id'],
              'overallRecipientCount':details['groupVersionResult']['TEST']['customer_count'],
              'expectedDeliveryCount':details['groupVersionResult']['TEST']['customer_count'],
              'groupName':details['groupName']
             }
         communicationDetailObject = VenenoObject.communicationDetail(cdDetailsBody)
         communicationId = self.connObj.addMessageForRecipients(communicationDetailObject)
         VenenoDBAssertion(cdDetailsBody['campaignId'], cdDetailsBody['communicationType'], communicationId, cdDetailsBody['overallRecipientCount'], cdDetailsBody['recipientListId'], cdDetailsBody['subject'], testControlType='skip').check()
     except Exception, exp:
         raise Exception('Line Failure ,due to :{}'.format(exp))
Пример #20
0
 def est_venenoThrift_inboxUser_MobilePush_IOS(self):
     actualOrgId = construct.updateOrgId(constant.config['mobilepush']['orgId'])
     actualOrgName = construct.updateOrgName(constant.config['mobilepush']['orgName'])
     try:
         details = VenenoHelper.preRequisitesForVenenoMobilePush('ios',testControlType='skip')
 
         cdDetailsBody = {
              'campaignId':details['campaignId'],
              'communicationType':'PUSH',
              'subject':'Automation Generated Body ',
              'body':'{"templateData":{"ANDROID":{"luid":"{{luid}}","cuid":"{{cuid}}","communicationId":"{{communicationId}}","title":"hi {{first_name}}","message":"{{first_name}}","expandableDetails":{"style":"BIG_TEXT","message":"{{first_name}}"},"custom":[]},"IOS":{"luid":"{{luid}}","cuid":"{{cuid}}","communicationId":"{{communicationId}}","title":"hi {{first_name}}","message":"{{first_name}}","expandableDetails":{"style":"BIG_TEXT","message":"hi {{first_name}}","ctas":[]},"custom":[]}}}',
              'recipientListId':details['groupVersionResult']['TEST']['id'],
              'overallRecipientCount':details['groupVersionResult']['TEST']['customer_count'],
              'expectedDeliveryCount':details['groupVersionResult']['TEST']['customer_count'],
              'groupName':details['groupName']
             }
         communicationDetailObject = VenenoObject.communicationDetail(cdDetailsBody)
         communicationId = self.connObj.addMessageForRecipients(communicationDetailObject)
         VenenoDBAssertion(cdDetailsBody['campaignId'], cdDetailsBody['communicationType'], communicationId, cdDetailsBody['overallRecipientCount'], cdDetailsBody['recipientListId'], cdDetailsBody['subject'], testControlType='skip').check()
     except Exception, exp:
         raise Exception('MobilePush Failure ,due to :{}'.format(exp))
Пример #21
0
    def initializeConstants(args):
        module = constant.config['module'] = args.module.lower()
        runId = args.runId
        collectOnly = constant.config['collectOnly'] = args.collectOnly
        tcFilter = args.tcFilter
        cluster = constant.config['cluster'] = args.cluster.lower()
        if collectOnly:
            if 'cluster' in args.cluster.lower():
                cluster = constant.config['cluster'] = 'nightly'
            constant.config['campaignId'] = 1

        if module.lower() == 'nsadmin':
            if tcFilter != '':
                tcFilter += ' and'
            if cluster.lower() in ['nightly', 'staging']:
                tcFilter += ' not Prod'
            else:
                tcFilter += ' Prod and ' + str(cluster.title())
            if args.prodEmail1 != '':
                constant.prodNumbers['prodEmail1'] = args.prodEmail1
        constant.config['tcFilter'] = tcFilter

        if not module in runId.lower():
            runId = module.title() + '_' + runId
        msg = 'Initializing Suite for Cluster: ' + cluster + ' Module: ' + module
        if tcFilter != '':
            msg += ' Filter: ' + tcFilter
        print msg

        constant.config['runId'] = runId
        constant.config['logDir'] = constant.logDirectory + runId
        constant.config['currentTimestamp'] = datetime.today().strftime('%Y-%m-%d %H:%M:%S')
        constant.config.update(constant.portsUsed[cluster])
        constant.config.update(constant.clusterUrl[cluster])
        constant.config.update(constant.auth[cluster])
        constant.config.update(constant.intouchEndpoints)
        constant.config.update(constant.endpoints)
        BaseState.updateOrgDetails(module)
        if module in ['iris','irisv2', 'veneno', 'darknight', 'campaign_shard', 'campaignsui', 'social']:
            constant.config.update(constant.wechatMobilepush[cluster])
            if constant.config['cluster'] in ['nightly', 'staging', 'china']: constant.config['wecrm_details'] = \
                constant.config['wechat']['wecrm_details']
            constant.config.update(constant.aryaEndpoints)
            constant.config.update({'campaignDefaultObjectCopy': copy.deepcopy(constant.campaignDefaultValues)})
            try:
                authResponse = auth.authLogin()
                if authResponse['cookies'].get_dict() != {}:
                    constant.config['aryaCookiesDict'] = authResponse['cookies'].get_dict()
                    constant.config['token'] = authResponse['json']['token']
                else:
                    raise Exception('')
            except:
                print '------------------------------Arya Cookies Not Set------------------------------'

        if module in ['emf', 'peb']:
            orgId = constant.config['orgId']
            constant.config.update(constant.emfConstants[cluster][orgId])
        if module in ['luci', 'veneno', 'social']:
            constant.config['requestId'] = 'requestId_' + str(randValues.randomInteger(5))
            constant.config['dateTime'] = DracarysHelper.getValueOfDay()
        if not collectOnly:
            Utils.createFolder(constant.config['logDir'])
            Logger.configureLogging(constant.config['logDir'])
        if constant.config['os'] != 'windows':
            dbHelper.getIntouchShardNameForOrg(module)
            dbHelper.buildDBToTunnelPortMapping()
        if module == 'veneno' and not collectOnly:
            if constant.config['cluster'] == 'nightly': VenenoHelper.updateStartegyForRateLimit()
        if module == 'irisv2':
            constant.irisGenericValues = {'goalId': '1', 'objectiveId': '1', 'existingUserId': '1',
                                          'existingUserExternalId': '1'}
        if module in ['iris', 'veneno', 'campaign_shard', 'campaignsui', 'darknight', 'social']:
            constant.config['skipped_errors'] = dbCallsList.getSkippedErrorTypes()
            constant.config.update(constant.irisDetails[cluster])
            if collectOnly:
                constant.irisGenericValues = {'goalId': '1', 'objectiveId': '1', 'existingUserId': '1',
                                              'existingUserExternalId': '1'}
            else:
                try:
                    goalId = str(dbCallsCampaign.getValidGoalId())
                    objectiveId = str(dbCallsCampaign.getValidObjectiveId())
                    existingUserDetail = dbCallsMessage.getUsersInformation(1)[0]
                    constant.irisGenericValues = {'goalId': goalId, 'objectiveId': objectiveId,
                                                  'existingUserId': existingUserDetail[0],
                                                  'existingUserExternalId': existingUserDetail[5]}
                except Exception, exp:
                    constant.irisGenericValues = {'goalId': '1', 'objectiveId': '1', 'existingUserId': '1',
                                                  'existingUserExternalId': '1'}
                    Logger.log(
                        'Exception :{} occured while setting irisGeneric Values , so setting the values by Default as :{}'.format(
                            exp, constant.irisGenericValues))
Пример #22
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     self.details = VenenoHelper.preRequisitesForVeneno(
         testControlType='custom')
Пример #23
0
 def teardown_class(self):
     Logger.log('Disable Rate Limit Config')
     VenenoHelper.configRateLimit(enable=False, channel='EMAIL')
Пример #24
0
 def test_veneno_rateLimit_MonthlyByPass(self, listType):
     VenenoHelper.setupStrategy(daily=3,
                                weekly=2,
                                monthly=1,
                                channel='WECHAT')
     VenenoHelper.updateWindowValueToByPassStrategy(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'],
         'MONTHLY',
         channel='WECHAT')
     self.listId = self.testObjectForRateLimit['list'][listType][
         'groupDetails']['id']
     campaignMessage.getWeCRMTemplates()
     subject = {
         "template_id":
         unicodedata.normalize('NFKD',
                               constant.config['templateId']).encode(
                                   'ascii', 'ignore'),
         "touser":
         "******",
         "OriginalId":
         constant.config['wechat']['OriginalId'],
         "Title":
         "",
         "BrandId":
         "f",
         "url":
         "http://we.capillarytech-cn.com/web?appid=wxc7bf989decc7e35b&redirect_uri=http://somelink.com/someword?nowAParam=firstParam&second=second.Param&response_type=code&scope=snsapi_base&state=STATE",
         "TopColor":
         "#000000",
         "data": {
             "productType": {
                 "value": "HakeemProduct",
                 "color": "#00000"
             },
             "name": {
                 "value": "Hakeem {{first_name}} Lukka",
                 "color": "#00000"
             },
             "number": {
                 "value": "898767 skdjnjn",
                 "color": "#00000"
             },
             "expDate": {
                 "value": "look down",
                 "color": "#00000"
             },
             "remark": {
                 "value": "Look up",
                 "color": "#00000"
             }
         }
     }
     cdDetailsBody = {
         'campaignId':
         self.testObjectForRateLimit['campaign']['id'],
         'communicationType':
         'WECHAT',
         'subject':
         str(subject),
         'body':
         'Thrift Created Automation Wechat Body',
         'recipientListId':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['id'],
         'overallRecipientCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'expectedDeliveryCount':
         self.testObjectForRateLimit['list'][listType]
         ['groupVersionDetails']['TEST']['customer_count'],
         'groupName':
         self.testObjectForRateLimit['list'][listType]['groupDetails']
         ['group_label']
     }
     communicationDetailObject = VenenoObject.communicationDetail(
         cdDetailsBody)
     communicationId = self.connObj.addMessageForRecipients(
         communicationDetailObject)
     VenenoDBAssertion(
         cdDetailsBody['campaignId'],
         cdDetailsBody['communicationType'],
         communicationId,
         cdDetailsBody['overallRecipientCount'],
         cdDetailsBody['recipientListId'],
         cdDetailsBody['subject'],
         skippedReasons=[
             'Captured OpenId for user seems to be unsubscribed',
             'rate limit crossed for user'
         ]).check()
     authorize.dbAssertRateLimitStats(
         self.testObjectForRateLimit['list'][listType]
         ['campaignGroupRecipients']['TEST'], {
             'DAILY': 3,
             'WEEKLY': 2,
             'MONTHLY': 1
         },
         channel='WECHAT')
Пример #25
0
 def setup_method(self, method):
     self.connObj = VenenoHelper.getConnObj(newConnection=True)
     constant.config['uploadedFileName'] = method.__name__
     Logger.logMethodName(method.__name__)
Пример #26
0
 def setup_method(self, method):
     self.connObj = VenenoHelper.getConnObj(newConnection=True)
     Logger.logMethodName(method.__name__)
Пример #27
0
 def teardown_class(self):
     Logger.log('Disable Rate Limit Config')
     VenenoHelper.configRateLimit(enable=False, channel='PUSH')
     construct.updateOrgId(self.actualOrgId)
     construct.updateOrgName(self.actualOrgName)