Ejemplo n.º 1
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))
Ejemplo n.º 2
0
 def setup_class(self):
     campaignMessage.getWeCRMTemplates()
     self.nonWechatOrgId = construct.updateOrgId(
         constant.config['wechat_org_id'])
     self.templateIdDict = campaignMessage.setupTemplateId()
     createListresponse, createListPayload, campaignId = campaignList.createList(
         {
             'customTagCount': 0,
             'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
         },
         campaignId=Test_Wechat_CreateMessage.createCampaign())
     campaignList.assertCreateList(createListresponse, 200)
     groupVersionDetailResult, bucketId = campaignList.assertCreateListDbCalls(
         createListresponse['json']['entity']['listId'], createListPayload,
         'ORG')
     Logger.log('GroupVersionId : {}, bucketId : {}'.format(
         groupVersionDetailResult, bucketId))
     addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
         Test_Wechat_CreateMessage.addRecipientPayload(), campaignId,
         createListresponse['json']['entity']['listId'])
     campaignList.assertAddRecipient(addRecipientResponse, 200)
     responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
         campaignId=campaignId)
     self.groupVersionResult = dbCallsList.getGroupVersionDetailsWithGroupId(
         createListresponse['json']['entity']['listId'])
     self.bucketId = bucketId
     self.strategy = construct.constructStrategyIds()
     self.programeId = self.strategy['programeId']
     self.allocationStrategyId = self.strategy['allocationStrategyId']
     self.expiryStrategyId = self.strategy['expirationStrategyId']
     self.voucherId = responseCoupon['json']['entity']['voucherSeriesId']
     self.campaignId = campaignId
     self.listId = createListresponse['json']['entity']['listId']
     campaignMessage.updateDefaultMessageJson(self.campaignId, self.listId,
                                              self.voucherId, self.strategy,
                                              self.bucketId,
                                              self.groupVersionResult)
     constant.messagesDefault['updated'] = True
     Logger.log(
         'Using CampaignId : {} , listId : {} for Execution of Create Message'
         .format(self.campaignId, self.listId))
Ejemplo n.º 3
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')