Exemplo n.º 1
0
 def assertInboxes(self):
     try:
         inboxInfo = DBCallsCampaigns.getInboxDetails(self.bucketId, self.communicationDetailsId)
         self.numberOfExecutedUsers = len(inboxInfo)
         self.inboxDetails = {}
         for eachExecutedUser in inboxInfo:
             self.inboxDetails[eachExecutedUser[0]] = eachExecutedUser[1]
         Logger.log('Inbox Details are :{}'.format(self.inboxDetails))
     except Exception, exp:
         raise Exception('Inboxes Failure :{}'.format(exp))
Exemplo n.º 2
0
 def assertSkipped(self):
     try:
         skippedInfo = DBCallsCampaigns.getSkippedDetails(self.bucketId, self.communicationDetailsId)
         self.numberOfSkippedUsers = len(skippedInfo)
         self.skippedDetails = {}
         for eachUser in skippedInfo:
             self.skippedDetails[eachUser[0]] = eachUser[1]
         Logger.log('Skipped Details are :{}'.format(self.skippedDetails))
     except Exception, exp:
         raise Exception('Skipped Failure :{}'.format(exp))
Exemplo n.º 3
0
 def test_pasteList_wrongOrgId(self):
     response, payload = campaigns.createCampaign(campaignTypeParams=['LIVE', 'ORG'])
     campaigns.assertCreateCampaign(response, 200)
     campaignId = response.get('json').get('entity').get('campaignId')
     previousOrgId = construct.updateOrgId(0)
     try:
         responseCreateList, payload, campaignId = campaignList.createList({}, campaignId=campaignId)  
         campaignList.assertCreateList(responseCreateList, 400, 2003, 'Invalid campaign  id : ' + str(campaignId)[:3] + ',' + str(campaignId)[3:])
     except AssertionError, exp:
         Logger.log('Assertioin Failed as :', exp)
Exemplo n.º 4
0
 def assertCommunicationDetails(self):
     try:
         self.communicationDetailsId, self.bucketId, self.targetType, self.expectedCount, self.overallCount, self.state = DBCallsCampaigns.getCommunicationDetails(self.campaignId)
         self.numberOfTestUsers = self.overallCount
         self.numberOfControlUsers = self.numberOfUsers - self.numberOfTestUsers
         Logger.log('Number Of Test users :{} and number of Control users :{}'.format(self.numberOfTestUsers, self.numberOfControlUsers))
         Assertion.constructAssertion(self.state == 'OPENED', 'State of Timeline in CD is :{}'.format(self.state))
         Assertion.constructAssertion(self.targetType == 'TIMELINE', 'TargetType for Timeline in CD is :{}'.format(self.targetType))
     except Exception, exp:
         raise Exception('Communication Details Failure :{}'.format(exp))
Exemplo n.º 5
0
 def createCustomList(self, userlist, customAudienceListDetails,
                      socialAccountDetails, orgId, recepientlistId,
                      requestId):
     Logger.log('Call :{} , Params :{},{},{},{},{},{}'.format(
         'createCustomList', userlist, customAudienceListDetails,
         socialAccountDetails, orgId, recepientlistId, requestId))
     return self.log(
         self.conn.createCustomList(userlist, customAudienceListDetails,
                                    socialAccountDetails, orgId,
                                    recepientlistId, requestId))
Exemplo n.º 6
0
 def waitUntil(self, nsadminId, status, timeOut = 60):
     for _ in range(0, timeOut):
         msgResp = self.nsObj.getMessagesById([nsadminId])[0]
         if msgResp.status in status:
             Logger.log('returning ')
             return msgResp
         else:
             time.sleep(1)
     Logger.log('returning false')
     return False
Exemplo n.º 7
0
 def assertGetAdsetInsight(AdInsightObject, adsetId):
     Assertion.constructAssertion(
         AdInsightObject.orgId == constant.config['orgId'],
         'Adsetinsight Mapped to Correct org :{}'.format(
             constant.config['orgId']))
     Assertion.constructAssertion(
         Adsetinsight.adsetId == adsetId,
         'Adset Mapping to Insight , Actual :{} and Expected :{}'.format(
             Adsetinsight.adsetId, adsetId))
     Logger.log(Adsetinsight.insights)
Exemplo n.º 8
0
 def assertCommunicationDetailInErrorState(groupVersionId, communicationId):
     for _ in range(10):
         time.sleep(30)
         try:
             social_info(
                 groupVersionid=groupVersionId,
                 messageId=communicationId).veneno_monitoringStatus()
             break
         except Exception, exp:
             Logger.log('Monitoring Status Still Not Updated')
Exemplo n.º 9
0
 def setupStrategy(daily=None, weekly=None, monthly=None, channel='SMS'):
     Logger.log(
         'Setting up Strategy with Daily :{} , weekly :{} and monthly :{}'.
         format(daily, weekly, monthly))
     if daily is not None:
         dbCallsAuthorize.setupStrategy(daily=daily, channel=channel)
     if weekly is not None:
         dbCallsAuthorize.setupStrategy(weekly=weekly, channel=channel)
     if monthly is not None:
         dbCallsAuthorize.setupStrategy(monthly=monthly, channel=channel)
Exemplo n.º 10
0
 def getDimAttrValuesByConstraints(self, dimName, levelName, searchText):
     Logger.log(
         'Params : OrgId :{} and clientType as :{} and LevelName :{} and searchText :{}'
         .format(constant.config['orgId'], dimName, levelName, searchText))
     return self.log(
         self.conn.getDimAttrValuesByConstraints(
             constant.config['orgId'], dimName, levelName,
             ReonObject().TDimOperationType['SEARCH'],
             ReonObject().TDimParams(searchText), list(),
             ReonObject().TMetaClient['READ_API']))
Exemplo n.º 11
0
 def goToOverviewpage(self):
     try:
         Logger.log('Going To Overview Page using heading-campaign-name')
         self.waitForElement(self.txt_campaignNameOnOverview_id)
         if self.isElementPresent(self.txt_campaignNameOnOverview_id):
             self.elementClick(self.txt_campaignNameOnOverview_id)
         else:
             assert False, 'Overview Page Locator is not Present'
     except Exception, exp:
         raise Exception('Go To OverviewPage Exception :{}'.format(exp))
Exemplo n.º 12
0
 def openNewCampaignCreationForm(self):
     try:
         Logger.log('Opening Create Campaign Form Fill Page ')
         self.waitForElement(self.btn_newCampaign_id)
         if self.isElementPresent(self.btn_newCampaign_id):
             self.elementClick(self.btn_newCampaign_id)
         else:
             assert False, 'Create Campaign Button Locator is not Present'
     except Exception, exp:
         raise Exception('Campaign Create Exception :{}'.format(exp))
Exemplo n.º 13
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     self.connObj = LuciHelper.getConnObj()
     self.constructObj = LuciObject()
     self.userIds = []
     self.bulkUserIds = []
     self.DracarysObj = DracarysObject()
     for i in range(len(constant.config['usersInfo'])):
         self.userIds.append(constant.config['usersInfo'][i]['userId'])
     self.tillId = constant.config['tillIds'][0]
Exemplo n.º 14
0
 def readFileFromS3(bucketName, keyName):
     bucketName = AWSHelper.updateBucketName(bucketName)
     Logger.log('Reading File from BucketName :{} and keyName :{}'.format(
         bucketName, keyName))
     session = boto3.Session(aws_access_key_id=constant.awsKey,
                             aws_secret_access_key=constant.awsSecret)
     s3 = session.resource('s3')
     data = s3.Object(bucketName,
                      keyName).get()['Body'].read().decode('utf-8')
     return data.split('\n')
Exemplo n.º 15
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     self.constructObj = LuciObject()
     self.DracarysObj = DracarysObject()
     self.userId = constant.config['usersInfo'][0]['userId']
     self.tillId = constant.config['tillIds'][0]
     self.userIds = []
     for i in range(len(constant.config['usersInfo'])):
         self.userIds.append(constant.config['usersInfo'][i]['userId'])
     self.billId = Utils.getTime(milliSeconds=True)
Exemplo n.º 16
0
 def validate(self):
     for eachentity in self.response['json']['entity']:
         Logger.log('Validation for Programe id : {}'.format(
             eachentity['programId']))
         Assertion.constructAssertion(
             eachentity['programId'] in self.pointsMeta,
             'Programeid :{} found in DB'.format(eachentity['programId']))
         self.basicValidationForProgram(eachentity)
         self.validateTiersForEachEntity(eachentity)
         self.validateStrategy(eachentity)
Exemplo n.º 17
0
 def getPurchaseHistoryForCustomerFiltered(self, orgID, customerId,
                                           purchaseHistoryFilterParams):
     Logger.log('orgID: ', orgID, ' customerId:', customerId,
                ' purchaseHistoryFilterParams: ',
                purchaseHistoryFilterParams, ' serverReqId: ',
                self.serverRequestID)
     return self.log(
         self.conn.getPurchaseHistoryForCustomerFiltered(
             orgID, customerId, purchaseHistoryFilterParams,
             self.serverRequestID))
Exemplo n.º 18
0
 def getAllPointsRedemptionSummaryForCustomerFiltered(
         self, customerFilter, pointsRedemptionFilterParams):
     Logger.log('customerFilter: ', customerFilter,
                ' pointsRedemptionFilterParams:',
                pointsRedemptionFilterParams, ' serverReqId: ',
                self.serverRequestID)
     return self.log(
         self.conn.getAllPointsRedemptionSummaryForCustomerFiltered(
             orgID, customerFilter, includePointsDeductions,
             self.serverRequestID))
Exemplo n.º 19
0
    def test_campaignShardThrift_reloadFilterBasedList_newBucket_partiallyDistributedBucket(
            self, campaignType, audienceType):
        self.bucketDetails = CampaignShardHelper.updateBucketIdRowCount(
            rows_count=14999990)
        existingList = constant.thiriftCampaignShardTestReferenceObject[
            campaignType]['campaign']['lists'][audienceType][1]
        userPayloadInfo = CampaignShardHelper.loyaltyUserDataConstructHelper()
        s3InfoForUsedList = CampaignShardHelper.getS3Info(existingList['uuid'])

        thriftCampaignGroup = lambda campaignTargetType: self.campaignShardObject.CampaignGroup(
            {
                'campaignId':
                constant.thiriftCampaignShardTestReferenceObject[campaignType][
                    'campaign']['id'],
                'groupId':
                existingList['groupDetails']['id'],
                'groupLabel':
                existingList['groupLabel'],
                'params':
                str(),
                'campaignGroupType':
                'LOYALTY',
                'campaignTargetType':
                'TEST',
                'customerCount':
                existingList['groupVersionDetails'][campaignTargetType][
                    'customer_count'],
                'uuId':
                existingList['uuid'],
                'versionNumber':
                1,
                's3Path':
                s3InfoForUsedList['response']['data']['s3Path'],
                's3Headers':
                s3InfoForUsedList['response']['data']['s3Header'],
                's3BucketTag':
                s3InfoForUsedList['response']['data']['s3Path'].split('/')[2]
            })

        for eachTargetType in ['TEST']:
            if not self.connObj.reloadGroup(
                    thriftCampaignGroup(eachTargetType)):
                Logger.log(
                    'For TargetType :{} , reload was unsuccesfull'.format(
                        eachTargetType))

        CampaignShardHelper.validateBucketIdWhenBucketUpdated(
            existingList['groupDetails']['id'],
            self.bucketDetails['oldBucket'])

        CampaignShardDBAssertion(
            constant.thiriftCampaignShardTestReferenceObject[campaignType]
            ['campaign']['id'], campaignType, 'loyalty',
            existingList['groupLabel'], existingList['groupDetails']['id'],
            'firstName,lastName,mobile', userPayloadInfo).check()
Exemplo n.º 20
0
 def validateBucketIdWhenBucketUpdated(groupId, expectedBucketDetails):
     Logger.log(
         'Checking for Bucket Id with groupId :{} and expectedBucketDetails:'
         .format(groupId, expectedBucketDetails))
     groupVersionDetailslatest = dbCallsList.getGroupVersionDetailsWithGroupId(
         groupId)
     latestBucketId = groupVersionDetailslatest['TEST']['bucket_id']
     Assertion.constructAssertion(
         int(latestBucketId) == expectedBucketDetails,
         'Expected Bucket Id :{} but actually in DB :{}'.format(
             expectedBucketDetails, latestBucketId))
Exemplo n.º 21
0
 def __init__(self,
              metaDetails,
              campaignGroupRecipients=False,
              campaignGroupRecipientsForCustomTag=False):
     Logger.log('Getting Data Details for groupId : {}'.format(
         metaDetails['groupId']))
     self.metaDetails = metaDetails
     self.dataDetail = dict()
     if campaignGroupRecipients: self.campaignGroupRecipients()
     if campaignGroupRecipientsForCustomTag:
         self.campaignGroupRecipientsForCustomTag()
Exemplo n.º 22
0
 def getElement(self, locator, locatorType="id"):
     element = None
     try:
         element = self.getByType(locatorType, locator)[0]
         Logger.log("Element found with locator: " + locator +
                    " and  locatorType: " + locatorType)
     except:
         Logger.log("Element not found with locator: " + locator +
                    " and  locatorType: " + locatorType)
     finally:
         return element
Exemplo n.º 23
0
 def elementClick(self, locator, locatorType="id"):
     try:
         element = self.getElement(locator, locatorType)
         Logger.log("Clicked on element :{} with locator {}".format(
             element, locator))
         element.click()
     except Exception, exp:
         Logger.log(
             'ElementClick Exception :{} but we will retry to click on Element as Element is captured'
             .format(exp))
         self.retryElementClick(locator, locatorType)
Exemplo n.º 24
0
 def createSlabAndUpdateStrategies(self, programId, orgId, slabInfo,
                                   strategyInfos, lastModifiedBy,
                                   lastModifiedOn):
     Logger.log('programId: ', programId, ' orgId: ', orgId, ' slabInfo: ',
                slabInfo, ' strategyInfos: ', strategyInfos,
                ' lastModifiedBy: ', lastModifiedBy, ' lastModifiedOn: ',
                lastModifiedOn, ' serverReqId: ', self.serverRequestID)
     return self.log(
         self.conn.createSlabAndUpdateStrategies(
             strategyInfo, programId, orgId, slabInfo, strategyInfos,
             lastModifiedBy, lastModifiedOn, self.serverRequestID))
Exemplo n.º 25
0
 def saveTemplate(self):
     try:
         self.waitForElement(self.selectTemplateNext_id)
         for retry in range(10):
             if self.isElementPresent(self.selectTemplateNext_id):
                 time.sleep(5)
                 self.elementClick(self.selectTemplateNext_id)
             else:
                 if retry > 2: break
     except Exception, exp:
         Logger.log('Exception :{} while Save Template'.format(exp))
Exemplo n.º 26
0
    def createTemplate(self, channel='sms', TemplateType='Use Editor'):
        try:
            Logger.log('Creating Template')
            self.waitForElement(self.btn_createTemplate_xpath,
                                locatorType='xpath')
            if self.isElementPresent(self.btn_createTemplate_xpath,
                                     locatorType='xpath'):
                self.elementClick(self.btn_createTemplate_xpath,
                                  locatorType='xpath')
            else:
                assert False, 'Create Template Button Not Found for channel :{}'.format(
                    channel)

            if channel.lower() == 'email':
                if TemplateType == 'Use Editor':
                    emailTemplateType = self.getElements(
                        self.sel_template_emailType_xpath, locatorType='xpath')
                    for eachEmailTemplateType in emailTemplateType:
                        if eachEmailTemplateType.text == 'Use Editor':
                            eachEmailTemplateType.click()

                    self.waitForElement(self.layout_email_xpath,
                                        locatorType='xpath')
                    if self.isElementPresent(self.layout_email_xpath,
                                             locatorType='xpath'):
                        firstLayout = self.getElements(self.layout_email_xpath,
                                                       locatorType='xpath')[0]
                        self.moveToElement(firstLayout)
                        self.moveToElement(
                            self.getElement(self.layout_btn_selectLayout_xpath,
                                            locatorType='xpath'))
                        self.elementClickWithAction(
                            self.layout_btn_selectLayout_xpath,
                            locatorType='xpath')
                elif TemplateType == 'Upload File':
                    Logger.log('Uploading File from path :',
                               constant.randomHtmlPath)
                    time.sleep(5)
                    inputFieldForUpload = self.getElement(
                        self.upload_filename_xpath, locatorType='xpath')
                    inputFieldForUpload.send_keys(constant.randomHtmlPath)
                else:
                    raise Exception(
                        'NoSuchTemplateTypeException : TemplateType :{}'.
                        format(TemplateType))
            elif channel.lower() == 'mobile push':
                templateTypeElement = self.getElement(
                    self.push_templateType_xpath.replace(
                        '{templateType}', TemplateType),
                    locatorType='xpath')
                templateTypeElement.click()

        except Exception, exp:
            raise Exception('CreateTemplate Exception :{}'.format(exp))
Exemplo n.º 27
0
 def getCouponsCreated_Count(couponSeriesId, isValid=-1):
     query = 'SELECT count(1) FROM `luci`.`coupons_created` WHERE `org_id` = ' + str(constant.config['orgId']) + \
             ' AND `coupon_series_id` = ' + str(couponSeriesId)
     if isValid >= 0:
         query = query + ' AND is_valid = ' + str(isValid)
     result = dbHelper.queryDB(query, "luci")
     if len(result) == 0:
         Logger.log('No records found')
         return None
     else:
         return result[0][0]
Exemplo n.º 28
0
 def getSecretAValueOfUsersInList(self):
     allUsersValueToPassAsString = ""
     getSecretValueBasedOn = self.userDataSchema.split(',')[2]
     if len(self.usersDataPassed) == 0: return ()
     for eachUser in self.usersDataPassed:
         allUsersValueToPassAsString = allUsersValueToPassAsString + "'" + eachUser.split(
             ',')[2] + "',"
     Logger.log(allUsersValueToPassAsString)
     return dbCallsList.getSecretA(
         getSecretValueBasedOn,
         allUsersValueToPassAsString[:len(allUsersValueToPassAsString) - 1])
Exemplo n.º 29
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')
     self.campaignId = self.testObjectForRateLimit['campaign']['id']
     VenenoHelper.updateEmailStatus(self.testObjectForRateLimit['list'])
Exemplo n.º 30
0
 def getSumOfPointsAwarded(customerId):
     Logger.log('Get Points Awarded sum values')
     query = "SELECT SUM(points_value),SUM(redeemed_value) FROM warehouse.points_awarded WHERE org_id = {} AND program_id = {}  and customer_id = {}".format(constant.config['orgId'],constant.config['programId'],customerId)
     result = dbHelper.queryDB(query, 'warehouse')
     sumOfPA = {}
     if len(result) == 0:
         Logger.log('No records found')
     else:
         for k in result:
             sumOfPA.update({'sumOfPointsValue' : k[0], 'sumOfRedeemedValue' : k[1]})
     return sumOfPA