示例#1
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     self.mobile1 = '918660430751'
     self.mobile2 = '918660430752'
     DarknightHelper.getMongoConnection('whitelisting', 'mobile_status')
     self.monthList = DarknightHelper.monthlyDelta()
     self.orgId = constant.config['orgId']
示例#2
0
 def test_countGreaterThan3_case5(self):        
     last_success_on = self.monthList[2]
     last_failed_on = self.monthList[2] - timedelta(days=2)        
     DarknightHelper.generateSmsWhitelistingData({'delivered' : 1, 'not_delivered' : 3, 
         'last_success_on' : last_success_on, 'last_failed_on' : last_failed_on})
     resObj = self.dnObj.getMobileStatus([self.mobile1], self.orgId)
     Assertion.constructAssertion(resObj == {self.mobile1 : True}, 'Verifying 0001')
示例#3
0
 def test_countGreaterThan3_case6(self):        
     last_failed_on = self.monthList[0]
     DarknightHelper.generateSmsWhitelistingData({
         'not_delivered' : 4, 
         'last_failed_on' : last_failed_on,
         "monthly_stats": [{"year": last_failed_on.year, "month": last_failed_on.month, 
                         "not_delivered": 4, "total": 4}]})
     resObj = self.dnObj.getMobileStatus([self.mobile1], self.orgId)
     Assertion.constructAssertion(resObj == {self.mobile1 : False}, 'Verifying 0000')
示例#4
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()
示例#5
0
 def test_countGreaterThan3_case19(self):        
     last_failed_on = self.monthList[0]
     DarknightHelper.generateSmsWhitelistingData({
         'not_delivered' : 2, 
         'delivered' : 8, 
         'last_failed_on' : self.monthList[0], 
         'last_success_on' : self.monthList[0] - timedelta(days=1),
         "monthly_stats": [{
             "year": last_failed_on.year, 
             "month": last_failed_on.month, 
             "not_delivered": 2,
             "not_delivered": 8, 
             "total": 10}]})
     resObj = self.dnObj.getMobileStatus([self.mobile1], self.orgId)
     Assertion.constructAssertion(resObj == {self.mobile1 : False}, 'Verifying 1111111100')
示例#6
0
文件: test_SMS.py 项目: anupsl/pyApps
 def test_sendMessage_smsWhitelisting(self, priority, gateway, status):
     mobile = '919980142462'
     last_failed_on = datetime.now()
     DarknightHelper.getMongoConnection('whitelisting', 'mobile_status')
     domainId = self.nsadminHelper.addDefaultDomain()
     DarknightHelper.generateSmsWhitelistingData(
         {
             'not_delivered':
             4,
             'last_failed_on':
             last_failed_on,
             "monthly_stats": [{
                 "year": last_failed_on.year,
                 "month": last_failed_on.month,
                 "not_delivered": 4,
                 "total": 4
             }]
         }, mobile)
     self.nsadminHelper.configureGateway(priority, gateway)
     msgDict = {
         "messageClass": "SMS",
         'receiver': mobile,
         "priority": priority,
         "message": "test message with is_whitelisting_enabled " + priority,
         "additionalHeaders": {
             "is_whitelisting_enabled": "true"
         }
     }
     msgId1 = self.nsadminHelper.createAndSendMessage(msgDict)
     msgDict = {
         "messageClass": "SMS",
         'receiver': mobile,
         "priority": priority,
         "message":
         "test message with is_whitelisting_enabled false" + priority,
         "additionalHeaders": {
             "is_whitelisting_enabled": "false"
         }
     }
     msgId2 = self.nsadminHelper.createAndSendMessage(msgDict)
     self.nsadminHelper.assertWithWaitUntil(msgId1, status,
                                            'Messages status ACK', 10)
     self.nsadminHelper.assertWithWaitUntil(msgId2,
                                            ['RECEIVED_IN_QUEUE', 'SENT'],
                                            'Messages status ACK', 10)
示例#7
0
 def test_probCheck_case20(self):        
     DarknightHelper.generateSmsWhitelistingData({
         'not_delivered' : 3, 
         'delivered' : 7, 
         'last_failed_on' : self.monthList[0], 
         'last_success_on' : self.monthList[0] - timedelta(hours=2),
         "monthly_stats": [{
             "year": self.monthList[0].year, "month": self.monthList[0].month, 
             "not_delivered": 1, "delivered": 5, "total": 6}, {
             "year": self.monthList[1].year, "month": self.monthList[1].month, 
             "not_delivered": 1, "delivered": 1, "total": 2}, {
             "year": self.monthList[2].year, "month": self.monthList[2].month, 
             "not_delivered": 1, "delivered": 1, "total": 2}
         ]})
     DarknightHelper.generateSmsWhitelistingData({'not_delivered' : 3,
         'last_failed_on' : self.monthList[0]}, self.mobile2)        
     resObj = self.dnObj.getMobileStatus([self.mobile1, self.mobile2], self.orgId)
     Assertion.constructAssertion(resObj[self.mobile1] == False, 'Verifying 10 10 111110 62%')
     Assertion.constructAssertion(resObj[self.mobile2] ==  True, 'Verifying 000')
示例#8
0
 def test_fetchEmailStatus_CustomerAddAPI_Sanity(self):
     cusObj = InTouchAPI(Customer.Add())
     for _ in range(0, 13):
         status = DarknightHelper.getEmailStatus(cusObj.params['email'])
         if status == 'INVALID':
             break
         else:
             time.sleep(10)
     Assertion.constructAssertion(
         status == 'INVALID',
         'Verifying email status after registering from customer/add ' +
         cusObj.params['email'])
示例#9
0
 def test_probCheck_case21(self):        
     DarknightHelper.generateSmsWhitelistingData({
         'not_delivered' : 7, 
         'delivered' : 19, 
         'last_failed_on' : self.monthList[0], 
         'last_success_on' : self.monthList[0] - timedelta(days=1),
         "monthly_stats": [{
             "year": self.monthList[0].year, "month": self.monthList[0].month, 
             "not_delivered": 1, "delivered": 5, "total": 6},{
             "year": self.monthList[1].year, "month": self.monthList[1].month, 
             "not_delivered": 1, "delivered": 5, "total": 6}, {
             "year": self.monthList[2].year, "month": self.monthList[2].month, 
             "not_delivered": 1, "delivered": 5, "total": 6},{
             "year": self.monthList[3].year, "month": self.monthList[3].month, 
             "not_delivered": 1, "delivered": 1, "total": 2}, {
             "year": self.monthList[4].year, "month": self.monthList[4].month, 
             "not_delivered": 1, "delivered": 1, "total": 2},{
             "year": self.monthList[5].year, "month": self.monthList[5].month, 
             "not_delivered": 1, "delivered": 1, "total": 2}, {
             "year": self.monthList[6].year, "month": self.monthList[6].month, 
             "not_delivered": 1, "delivered": 1, "total": 2}
         ]})
     resObj = self.dnObj.getMobileStatus([self.mobile1], self.orgId)
     Assertion.constructAssertion(resObj[self.mobile1] ==  True, 'Verifying 10 10 10 10 011111 110111 111110 - 71%')
示例#10
0
 def test_fetchEmailStatus_CampaignPasteList_Sanity(self):
     mergeListresponse, mergeListPayload, campaignId = campaignList.mergeList(
         {},
         campaignType=['LIVE', 'SKIP', 'List', 'TAGS', 0],
         userType='email',
         numberOfUsers=1,
         numberOfCustomTags=0)
     recipients = mergeListPayload['recipients']['data'][0]
     recipients = recipients.split(',')
     email = recipients[-1]
     for _ in range(0, 13):
         status = DarknightHelper.getEmailStatus(email)
         if status == 'INVALID':
             break
         else:
             time.sleep(10)
     Assertion.constructAssertion(
         status == 'INVALID',
         'Verifying email status from paste list upload in campaigns: ' +
         email)
示例#11
0
 def setup_method(self, method):
     self.dnObj = DarknightHelper.getConnObj(newConnection=True)
     Logger.logMethodName(str(method.__name__))
示例#12
0
 def test_countLessThan3_case2(self):
     DarknightHelper.generateSmsWhitelistingData({'not_delivered' : 2, 
         'last_failed_on' : self.monthList[2]})
     resObj = self.dnObj.getMobileStatus([self.mobile1], self.orgId)
     Assertion.constructAssertion(resObj == {self.mobile1 : True}, 'Verifying 00')
示例#13
0
 def test_countGreaterThan3_case18(self):        
     DarknightHelper.generateSmsWhitelistingData({'not_delivered' : 2, 'delivered' : 8, 
         'last_failed_on' : self.monthList[2], 'last_success_on' : self.monthList[2] - timedelta(days=1)})
     resObj = self.dnObj.getMobileStatus([self.mobile1], self.orgId)
     Assertion.constructAssertion(resObj == {self.mobile1 : True}, 'Verifying 1111111100')