Beispiel #1
0
 def assertVenenoDataDetails(self):
     try:
         self.assertInboxes()
         self.assertSkipped()
         Assertion.constructAssertion(self.numberOfTestUsers == self.numberOfExecutedUsers + self.numberOfSkippedUsers, 'Number of TestUsers are : {} and Inboxes Users :{} and Skipped users are:{} '.format(self.numberOfTestUsers, self.numberOfExecutedUsers, self.numberOfSkippedUsers))
     except Exception, exp:
         raise Exception('Veneno Data Details Failure :{}'.format(exp))
Beispiel #2
0
 def validateErrorStatusAsync(groupId):
     groupDetailsVersionInfo = dbCallsList.getGroupVersionDetailsWithGroupId(
         groupId, expectedStatus='ERROR')
     Assertion.constructAssertion(
         groupDetailsVersionInfo['TEST']['status'] == 'ERROR',
         'Mark Error Status :{} and Expected :{} in GVD'.format(
             groupDetailsVersionInfo['TEST']['status'], 'ERROR'))
Beispiel #3
0
 def test_sendMessage_EMAIL_InvalidSender(self, priority, gateway):
     self.nsadminHelper.configureGateway(priority, gateway)
     msgDict = {
         "messageClass": "EMAIL",
         "priority": priority,
         'sender': '',
         "message": "test message with priority " + priority
     }
     msgId = self.nsadminHelper.createAndSendMessage(msgDict)
     resp = self.nsadminHelper.assertWithWaitUntil(
         msgId, ['RECEIVED_IN_QUEUE', 'SENT'], 'Messages status ACK', 10)
     Assertion.constructAssertion(resp.sender != '', 'sender is not empty')
     # msgObj without sender
     msgObj = {
         'inboxId': 1,
         'messageId': 1,
         'clientId': 111,
         'receiverId': 111,
         'campaignId': 222,
         'sendingOrgId': self.orgId,
         'messageClass': 'EMAIL',
         'receiver': '*****@*****.**',
         'priority': priority,
         'message': 'test message with priority ' + priority,
         'scheduledTimestamp': int(time.time()) * 1000,
         'body': 'test body'
     }
     msgObj = nsadmin.Message(**msgObj)
     msgId = self.nsObj.sendMessage(msgObj)
     self.nsadminHelper.assertWithWaitUntil(msgId,
                                            ['RECEIVED_IN_QUEUE', 'SENT'],
                                            'Messages status ACK', 10)
     Assertion.constructAssertion(resp.sender != '', 'sender is not empty')
    def test_LUCI_IC_DC_013(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            issuedTo=self.userId,
            dracraysUpload={'userOnly': True})

        LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})
        LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']},
            couponIssuedCount=2)
Beispiel #5
0
    def validateAudienceGroupDataSourceInfo(campaignType, audienceType,
                                            audienceGroupDataSourceInfo,
                                            totalNumberOfUsers):
        Logger.log(
            'S3 Path :{} , Header :{} , bucketName :{} with totalNumberOfUsers :{}'
            .format(audienceGroupDataSourceInfo.audienceS3Info.s3Path,
                    audienceGroupDataSourceInfo.audienceS3Info.s3Header,
                    audienceGroupDataSourceInfo.audienceS3Info.bucketName,
                    audienceGroupDataSourceInfo.audienceS3Info.customerCount))
        resultFromAWS = AWSHelper.readFileFromS3(
            audienceGroupDataSourceInfo.audienceS3Info.bucketName,
            audienceGroupDataSourceInfo.audienceS3Info.s3Path)
        Logger.log('Result From AWS :{} with count :{}'.format(
            resultFromAWS, len(resultFromAWS)))

        usersInCGR = \
            constant.thiriftCampaignShardTestReferenceObject[campaignType]['campaign']['lists'][audienceType][0][
                'campaignGroupRecipients']
        for eachVersion in usersInCGR:
            Logger.log('Matching users in version :{}'.format(eachVersion))
            usersVersionSpecific = usersInCGR[eachVersion]
            numberOfUsersInEachVersion = 0
            for eachUser in usersVersionSpecific:
                Assertion.constructAssertion(
                    str(eachUser) in resultFromAWS,
                    'UserId :{} from version :{}  found in aws list'.format(
                        eachUser, eachVersion))
                numberOfUsersInEachVersion = numberOfUsersInEachVersion + 1
            Logger.log('Total Number of users for version:{} are :{}'.format(
                eachVersion, numberOfUsersInEachVersion))
Beispiel #6
0
    def test_LUCI_GCD_029(self):
        # Save Coupon Config
        try:
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

            couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True, 'redeem_at_store': str([self.tillId])})
            couponConfigObj = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj)[0]

            couponCode1 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
            couponSearchRequest = {'sort': self.constructObj.sort['DESC'], 'couponSeriesType': self.constructObj.couponSeriesType['CAMPAIGN']}
            LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1])
            time.sleep(2)

            couponConfigObj.update({'series_type': 'DVS'})
            couponConfigObj = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfigObj)[0]
            couponCode2 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
            couponSearchRequest = {'sort': self.constructObj.sort['DESC'], 'couponSeriesType': self.constructObj.couponSeriesType['DVS']}
            LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode2, couponCode1])
            time.sleep(2)

            couponConfigObj.update({'series_type': 'GOODWILL'})
            LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfigObj)
            couponCode3 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
            couponSearchRequest = {'sort': self.constructObj.sort['DESC'], 'couponSeriesType': self.constructObj.couponSeriesType['GOODWILL']}
            LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode3, couponCode2, couponCode1])
        except Exception, luciExp:
            Logger.log('Luci Exception : ' , luciExp)
            luciExp = luciExp.__dict__
            Assertion.constructAssertion(luciExp['errorCode'] == constant.INVALID_INPUT, 'Luci Exception error code Actual: {} and Expected: {}'.format(luciExp['errorCode'], constant.INVALID_INPUT))
            Assertion.constructAssertion(luciExp['errorMsg'] == 'series type and owned by should be same', 'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))
Beispiel #7
0
 def redemptionDBAssertion(self,
                           couponSeriesId,
                           numRedeemed=1,
                           redeemedBy=[]):
     if not redeemedBy:
         redeemedBy = [self.userId]
     couponRedemptionList = LuciDBHelper.getCouponRedemptionsListByCouponSeriesId(
         couponSeriesId)
     Assertion.constructAssertion(couponRedemptionList is not None,
                                  'Coupon_redemption has the records')
     Assertion.constructAssertion(
         len(couponRedemptionList) == numRedeemed,
         'No of Coupon redeemed Actual: {} and Expected: {}'.format(
             len(couponRedemptionList), numRedeemed))
     for cr in couponRedemptionList:
         Assertion.constructAssertion(
             cr['redeemedUserId'] in redeemedBy,
             'Coupon redeemed by Actual: {} and Expected: {}'.format(
                 cr['redeemedUserId'], redeemedBy))
         Assertion.constructAssertion(
             cr['redeemedAtStore'] == self.tillId,
             'Redeemed Till id Actual: {} and Expected: {}'.format(
                 cr['redeemedAtStore'], self.tillId))
         Assertion.constructAssertion(
             cr['billId'] == self.billId,
             'Redeemed Bill Id Actual : {} and Expected: {}'.format(
                 cr['billId'], self.billId))
Beispiel #8
0
 def test_irisv2_getStatusBy_messageId_Yet_to_go(self, campaignType,
                                                 testControlType, channel,
                                                 messageInfo, queryParam):
     messageDetails = CreateMessage.create(campaignType,
                                           testControlType,
                                           'LOYALTY',
                                           channel,
                                           messageInfo,
                                           updateNode=True,
                                           lockNode=True)
     CreateMessage.assertResponse(messageDetails['RESPONSE'], 200)
     message_calls().waitForJobDetailsStatusToClose(
         messageDetails['RESPONSE']['json']['entity']['id'],
         'VARIANT_CREATION')
     approveRespone = AuthorizeMessage.approve(
         campaignType,
         testControlType,
         'LOYALTY',
         channel,
         messageInfo,
         messageCreateResponse=messageDetails)
     response = GetMonitoringDetails.getByMessageId(
         constant.config['node'][campaignType][testControlType]['CAMPAIGN']
         ['ID'], messageDetails['RESPONSE']['json']['entity']['id'],
         queryParam)
     actualResponse, expectedResponse = GetMonitoringDetails.formatingMonitorDetails(
         response,
         isScheduledMsg=True,
         isDeliveryBreakEnabled=False,
         forceUpdate=True)
     Assertion.constructAssertion(
         actualResponse == expectedResponse,
         'Monitoring Details response Matched Actual: {} and Expected: {}'.
         format(actualResponse, expectedResponse))
Beispiel #9
0
 def assertUserPresenceInNsAdminTable(messageId,
                                      bucketId,
                                      numberOfUsers,
                                      testControlType='org',
                                      verify=True,
                                      waitForInboxMsg=False,
                                      groupVersionId=0,
                                      channel=None):
     if testControlType == 'custom':
         numberOfUsers = 0
         groupVersionResult = dbCallsList.getGroupVersionDetailWithGroupVersionId(
             groupVersionId)
         listOfUsers = dbCallsList.getUsersFromCampaignGroupRecipient(
             groupVersionResult['bucket_id'],
             groupVersionId,
             channel=channel)
         bound = (90 * 128) / 100
         key = authorize.randomize(int(groupVersionResult['campaign_id']))
         for eachuser in listOfUsers:
             significant_bit = eachuser & 127
             significant_bit = authorize.randomize(significant_bit)
             bucket_position_of_input = (significant_bit ^ key) & 127
             if bucket_position_of_input > bound:
                 Logger.log('userid :{} is counted as Control')
             else:
                 numberOfUsers = numberOfUsers + 1
                 Logger.log('userid :{} is counted as Test')
     inboxDetailWithUserIds = dbCallsAuthorize.getInboxDetail(
         bucketId, messageId, waitForInboxMsg=waitForInboxMsg)
     Assertion.constructAssertion(
         len(inboxDetailWithUserIds) == numberOfUsers,
         'Number Of Users sent :{} and present in Inbox is:{}'.format(
             numberOfUsers, len(inboxDetailWithUserIds)),
         verify=verify)
Beispiel #10
0
    def test_LUCI_EI_013_02(self, description):
        config = {
            'client_handling_type': 'DISC_CODE_PIN',
            'any_user': False,
            'isExternalIssual': False
        }
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=config)
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=10,
            dracraysUpload={'couponCodeCAPS': False})

        time.sleep(10)

        queueSize = LuciHelper.getQueueSize(self, couponSeriesId)
        Assertion.constructAssertion(
            queueSize == 10,
            'External Coupons not pumped to Queue Actual: {}'.format(
                queueSize))

        couponCode, _ = LuciHelper.issueCouponAndAssertions(
            self, couponSeriesId)
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
Beispiel #11
0
 def test_createMessage_nonImmediateCampaign_Sanity(self, request,
                                                    messageType, listType,
                                                    incentiveType,
                                                    templateName,
                                                    scheduleType):
     self.createCampaignPage.navigateBackToCampaignsOverviewPage(
         dependencies={'list': ['loyalty']})
     try:
         self.createCampaignPage.goToMessagePage(messageType)
         self.messagePage.chooseRecipient(
             constant.config['list'][listType]['name'])
         self.messagePage.attachIncentive(incentiveType)
         self.messagePage.customizeContent(templateName)
         self.messagePage.deliverySetting(scheduleType)
         self.createCampaignPage.authorizePresentCampaignOnPage()
         time.sleep(70 * 4)
         self.messagePage.verifyAuthorizeCampaign(
             constant.config['campaign']['id'],
             constant.config['list'][listType]['id'],
             scheduleType=scheduleType,
             listName=constant.config['list'][listType]['name'])
     except Exception, exp:
         self.getScreenshot(request.node.name)
         Assertion.constructAssertion(
             False, 'Failure with Exception :{}'.format(exp))
Beispiel #12
0
 def test_campaignShard_upload_paste_mobile_groupTags(
         self, campaignType, userType, numberOfUsers, groupTags):
     createListresponse, createListPayload, campaignId = campaignList.createList(
         {
             'groupTags': groupTags,
             'name': 'CAMPAIGNSHARD_LIST_' + str(int(time.time() * 100000))
         },
         campaignId=self.campaignId[campaignType])
     if createListresponse['statusCode'] != 200:
         Assertion.constructAssertion(False, 'Not Able To Create List')
     addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
         {},
         campaignId,
         createListresponse['json']['entity']['listId'],
         str(userType),
         int(numberOfUsers),
         0,
         newUser=False)
     if addRecipientResponse['statusCode'] != 200:
         Assertion.constructAssertion(False, 'Not Able To Add Recipient')
     CampaignShardDBAssertion(
         self.campaignId[campaignType],
         campaignType,
         'upload',
         createListPayload['name'],
         createListresponse['json']['entity']['listId'],
         addRecipientPayload['schema'],
         addRecipientPayload['data'],
         numberOfCustomTags=0,
         numberOfGroupTags=len(groupTags)).check()
Beispiel #13
0
 def test_timeline_Coupon(self, request):
     self.campaignName = 'TimelineSanityPoint' + str(int(time.time()))
     try:
         self.createCampaignPage.createTimelineCampaign(
             self.campaignName,
             timelineEndTime=constant.timelineDetails[
                 constant.config['cluster']]['timelineEndTime'])
         self.createCampaignPage.goToIncentivePage()
         self.incentivePage.createNewCoupon(couponName='coupon_' +
                                            str(int(time.time())))
         self.createCampaignPage.goToOverviewpage()
         self.timelinePages.createNewTimeline()
         self.timelinePages.fillTimelineDetails()
         self.timelinePages.selectSegment(constant.config['segment'])
         self.timelinePages.selectStartDateForCustomers()
         self.timelinePages.configureMilestione()
         self.timelinePages.selectIncentive(enableCoupon=True)
         self.timelinePages.customizeContent(
             constant.config['timeline_templateName']['templateNameCoupon'])
         self.timelinePages.saveMileston()
         self.timelinePages.saveAndExitTimeline()
         self.timelinePages.setCompressionFactor()
         self.timelinePages.rollOutCampaign()
         TimelineDBAssertion(self.campaignName).check()
     except Exception, exp:
         self.getScreenshot(request.node.name)
         Assertion.constructAssertion(False, exp)
Beispiel #14
0
 def test_LUCI_RSC_002(self, description, config):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, config)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     # Issue Coupon Code
     couponCode = LuciHelper.issueCouponAndAssertions(self,
                                                      couponSeriesId)[0]
     resendRequest = LuciObject.resendCouponRequest({
         'storeUnitId':
         self.tillId,
         'eventTimeInMillis':
         Utils.getTime(milliSeconds=True),
         'couponCode':
         couponCode,
         'userId':
         self.userId
     })
     couponDetails = self.connObj.resendCoupon(resendRequest).__dict__
     Assertion.constructAssertion(
         couponCode == couponDetails['couponCode'],
         'Resend Coupon Code Actual: {} and Expected: {}'.format(
             couponCode, couponDetails['couponCode']))
     Assertion.constructAssertion(
         couponDetails['ex'] == None,
         'Resend Coupon No exception occurred : {}'.format(
             couponDetails['ex']))
Beispiel #15
0
 def assertGroupVersionBasedOnTestControlType(self):
     Assertion.constructAssertion(
         int(self.groupVersionDetailResult['TEST']['bucket_id']) > 0,
         'BucketId should Always be greater then 0')
     Assertion.constructAssertion(
         self.groupVersionDetailResult['TEST']['customer_count']
         in range(self.numberOfTestUsers + self.numberOfControlUsers - 2,
                  self.numberOfTestUsers + self.numberOfControlUsers + 2),
         'Test Users Count in GroupVersion :{} and as per Test Control Calculation :{}'
         .format(self.groupVersionDetailResult['TEST']['customer_count'],
                 self.numberOfTestUsers + self.numberOfControlUsers))
     paramsInfo = json.loads(
         self.groupVersionDetailResult['TEST']['params'])
     Assertion.constructAssertion(
         paramsInfo['test_count'] == self.numberOfTestUsers,
         'Test Count in params :{} and as per secretA Values :{}'.format(
             paramsInfo['test_count'], self.numberOfTestUsers))
     Assertion.constructAssertion(
         paramsInfo['control_count'] == self.numberOfControlUsers,
         'Control Count in params :{} and as per secretA Values :{}'.format(
             paramsInfo['control_count'], self.numberOfControlUsers))
     if self.testControlType.lower() != 'skip':
         if not self.newFlow:
             Assertion.constructAssertion(
                 self.groupVersionDetailResult['CONTROL']['customer_count']
                 == 0,
                 'Control Users Count in GroupVersion :{} and as per Test Control Calculation :{}'
                 .format(
                     self.groupVersionDetailResult['CONTROL']
                     ['customer_count'], 0))
    def validateDeliverySetting(self):
        for eachSetting in self.payload['deliverySetting']:
            Assertion.constructAssertion(eachSetting in self.messageDbDetail['message_collection']['deliverySetting'],
                                         'Setting :{} found in Db'.format(eachSetting))
            try:
                if eachSetting == 'additionalSetting':
                    Assertion.constructAssertion(
                        self.messageDbDetail['message_collection']['deliverySetting'][eachSetting]['useTinyUrl'] ==
                        self.payload['deliverySetting'][eachSetting]['useTinyUrl'],
                        'UseTinyURL in DB :{} and in payload passed as :{}'.format(
                            self.messageDbDetail['message_collection']['deliverySetting'][eachSetting]['useTinyUrl'],
                            self.payload['deliverySetting'][eachSetting]['useTinyUrl']))

                    Assertion.constructAssertion(
                        self.messageDbDetail['message_collection']['deliverySetting'][eachSetting]['encryptUrl'] ==
                        self.payload['deliverySetting'][eachSetting]['encryptUrl'],
                        'encryptUrl in DB :{} and in payload passed as :{}'.format(
                            self.messageDbDetail['message_collection']['deliverySetting'][eachSetting]['encryptUrl'],
                            self.payload['deliverySetting'][eachSetting]['encryptUrl']))

                    Assertion.constructAssertion(
                        self.messageDbDetail['message_collection']['deliverySetting'][eachSetting]['skipRateLimit'] ==
                        self.payload['deliverySetting'][eachSetting]['skipRateLimit'],
                        'skipRateLimit in DB :{} and in payload passed as :{}'.format(
                            self.messageDbDetail['message_collection']['deliverySetting'][eachSetting]['skipRateLimit'],
                            self.payload['deliverySetting'][eachSetting]['skipRateLimit']))
            except AssertionError, exp:
                Assertion.constructAssertion(False, 'ADditional Setting Check Failed with Exception :{}'.format(exp))
            except Exception, exp:
                Logger.log('While Checking Additional Setting Exception caught as :{}'.format(exp))
Beispiel #17
0
 def assertVeneno_WechatDetails(self):
     Assertion.constructAssertion(
         len(self.serviceDetailResult) >= 2,
         'Matching Length Of Service Details greater than 2')
     Assertion.constructAssertion(
         self.serviceDetailResult['DELIVERY_SERVER']['processed_count'] ==
         self.numberOfUsers,
         'Processed Count in DeliveryServer :{} and total numberOfUsers :{}'
         .format(
             self.serviceDetailResult['DELIVERY_SERVER']['processed_count'],
             self.numberOfUsers))
     Assertion.constructAssertion(
         self.serviceDetailResult['FEEDER']['processed_count'] ==
         self.numberOfUsers,
         'Processed Count in DeliveryServer :{} and total numberOfUsers :{}'
         .format(self.serviceDetailResult['FEEDER']['processed_count'],
                 self.numberOfUsers))
     Assertion.constructAssertion(
         self.serviceDetailResult['DELIVERY_SERVER']['message_version'] ==
         0, 'Message Version Id : {} for DELIVERY_SERVER'.format(
             self.serviceDetailResult['DELIVERY_SERVER']
             ['message_version']))
     Assertion.constructAssertion(
         self.serviceDetailResult['FEEDER']['message_version'] == 0,
         'Message Version Id : {} for FEEDER'.format(
             self.serviceDetailResult['FEEDER']['message_version']))
     if 'SKIPPED' in self.serviceDetailResult:
         self.numberOfSkippedUsers = self.serviceDetailResult['SKIPPED'][
             'processed_count']
         self.numberOfNsadminUsers = self.serviceDetailResult['DELIVERY_SERVER']['processed_count'] - \
                                     self.serviceDetailResult['SKIPPED']['processed_count']
     else:
         self.numberOfNsadminUsers = self.serviceDetailResult[
             'DELIVERY_SERVER']['processed_count']
         self.numberOfSkippedUsers = 0
    def validateJobDetailsForJobContextInTargetAudience(self):
        Assertion.constructAssertion(
            'targetAudienceId' in self.messageDbDetail['messageJobDetails_collection']['MESSAGE_TARGET_AUDIENCE'][0][
                'jobContext'], 'targetAudienceId present in jobContext')

        return self.messageDbDetail['messageJobDetails_collection']['MESSAGE_TARGET_AUDIENCE'][0][
            'jobContext']['targetAudienceId']
Beispiel #19
0
 def test_LUCI_GCC_001(self, description,ownerValues):
     configRequest = LuciObject.getCouponConfigRequest({'ownedBy' : ownerValues[0]})
     couponConfigList = self.connObj.getCouponConfiguration(configRequest)
     Assertion.constructAssertion(couponConfigList != None, 'Retrieved couponConfig from GetCouponConfig by OwnedBy')
     configRequest = LuciObject.getCouponConfigRequest({'ownerId': ownerValues[1]})
     couponConfigList = self.connObj.getCouponConfiguration(configRequest)
     Assertion.constructAssertion(couponConfigList != None, 'Retrieved couponConfig from GetCouponConfig by OwnedId')
 def validateMessageJobDetailCollection(self):
     for eachEntity in ['VARIANT_CREATION', 'MESSAGE_TARGET_AUDIENCE']:
         Assertion.constructAssertion(eachEntity in self.messageDbDetail['messageJobDetails_collection'],
                                      '{} : found in Job Details'.format(eachEntity))
     self.validateJobDetailsForTargetAudience()
     self.actualTargetAudience = self.validateJobDetailsForJobContextInTargetAudience()
     self.validateJobDetailsForVariants()
Beispiel #21
0
 def test_Count_Messages_RECEIVED_IN_QUEUE_READ(self):
     currentMonth = NSAdminHelper.getTableName()
     query = 'SELECT COUNT( * ) FROM ' + currentMonth + ' where sent_time >= SUBDATE( current_date, 2) and sent_time < current_date and status in (2,35)'
     output = dbHelper.queryDB(query, 'nsadmin')
     Assertion.constructAssertion(output[0][0] == 0,
                                  'RECEIVED_IN_QUEUE & READ count',
                                  verify=True)
 def validatePushBody(self, cdBody):
     expectedBody = self.constructMessageBodyForPush()
     actualBody = json.loads(cdBody)
     Assertion.constructAssertion(
         expectedBody == actualBody,
         'ExpectedBody :{} and actualBody :{}'.format(
             expectedBody, actualBody))
Beispiel #23
0
    def test_irisv2_getMessage_queryParam_withVariation(
            self, campaignType, testControlType, listType, channel,
            messageInfo):
        CreateMessage.create(campaignType, testControlType, listType, channel,
                             messageInfo)

        campaignId = constant.config['node'][campaignType][testControlType][
            'CAMPAIGN']['ID']
        messageId = constant.config['node'][campaignType][testControlType][
            'LIST'][listType][channel]['MESSAGE'][
                messageInfo['scheduleType']['type']][messageInfo['offerType']][
                    'RESPONSE']['json']['entity']['id']

        for eachType in ['MESSAGE_TARGET_AUDIENCE', 'VARIANT_CREATION']:
            status = message_calls().waitForJobDetailsStatusToClose(
                messageId, eachType, maxNumberOfAttempts=20)

        if status:
            getMessageResponse = GetMessage.getMessageById(
                campaignId, messageId, [('includeVariant', 'true')])
            GetMessage.assertResponse(getMessageResponse, 200)
            CreateMessageDBAssertion(
                campaignId, messageId,
                getMessageResponse['json']['entity']).check()
            VariantDBAssertion(
                campaignId, messageId, getMessageResponse['json']['entity']
                ['messageVariantList']).check()
        else:
            Assertion.constructAssertion(
                False, 'Variant_Creation is Not Closed in Specified time')
    def test_LUCI_IC_DCP_016(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'client_handling_type': 'DISC_CODE_PIN',
                'do_not_resend_existing_voucher': False,
                'allow_multiple_vouchers_per_user': True
            })

        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount == 0,
                                     'Coupons are created for DCP')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupons not pumped to queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self, couponSeriesId, self.constructObj.importType['NONE'])

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        LuciHelper.issueCouponAndAssertions(self,
                                            couponSeriesId,
                                            couponIssuedCount=2)
Beispiel #25
0
 def validateAudienceGroupBoolRes(listOfUsersAndStatus):
     for eachUserType in listOfUsersAndStatus:
         Logger.log('Validating for all :{} users'.format(eachUserType))
         for eachUserInfo in listOfUsersAndStatus[eachUserType]:
             Assertion.constructAssertion(
                 eachUserInfo[1], 'Status for UserId :{} is {}'.format(
                     eachUserInfo[0], eachUserInfo[1]))
    def test_LUCI_SCC_031_sanity(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon Code Pumped to Queue')
        couponConfigObj.update(
            {'description': 'luci testing description changed'})
        couponConfigObj = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigObj)[0]
        couponCode = LuciHelper.issueCouponAndAssertions(self,
                                                         couponSeriesId)[0]
        LuciHelper.redeemCouponAndAssertions(self, [couponSeriesId],
                                             [couponCode])
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)

        #Changing client-handling-type
        couponConfigObj.update({'client_handling_type': 'DISC_CODE_PIN'})
        LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj)
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)
        time.sleep(2)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(
            createdCouponCount == 0,
            'Config changed as DC to DCP and Coupon codes marked as invalid ')
Beispiel #27
0
    def test_sendMessasge_EMAIL_InvalidReceiver(self):
        self.nsadminHelper.configureGateway("BULK", "localmail_BULK")
        msgDict = {
            "receiver": "invalid",
            "messageClass": "EMAIL",
            "priority": "BULK",
            "message": "test message with receiver invalid"
        }
        msgId = self.nsadminHelper.createAndSendMessage(msgDict)
        self.nsadminHelper.assertWithWaitUntil(msgId, ['BLOCKED'],
                                               'Messages status ACK', 10)

        msgDict = {
            "receiver": "",
            "messageClass": "EMAIL",
            "priority": "BULK",
            "message": "test message with empty receiver"
        }
        resp = self.nsadminHelper.createAndSendMessage(msgDict)
        Assertion.constructAssertion(resp == -1, 'sendMessage output')

        msgDict = {
            "messageClass": "EMAIL",
            "priority": "BULK",
            "message": "test message with empty receiver"
        }
        msgObj = NSAdminObject.message(msgDict)
        resp = self.nsObj.sendMessage(msgObj)
        Assertion.constructAssertion(resp == -1, 'sendMessage output')
Beispiel #28
0
 def downloadCouponsRequestAndAssertion(self,
                                        couponSeriesId,
                                        reportType,
                                        couponCode=[]):
     requestObj = DracarysObject.DownloadCouponsRequest({
         'couponSeriesId':
         couponSeriesId,
         'downloadReportType':
         reportType
     })
     dcrResponse = self.DracraysConnObj.downloadCouponsReport(
         requestObj).__dict__
     Assertion.constructAssertion(
         dcrResponse['errorCode'] == 0,
         'Error Code is Actual : {} and Expected : 0'.format(
             dcrResponse['errorCode']))
     Assertion.constructAssertion(
         dcrResponse['errorMessage'] == None,
         'Error Message is Actual : {} and Expected : None'.format(
             dcrResponse['errorMessage']))
     Assertion.constructAssertion(
         dcrResponse['jobId'] != None,
         'JobId is Actual : {} and Expected : not None'.format(
             str(dcrResponse['jobId'])))
     Assertion.constructAssertion(
         dcrResponse['downloadReportType'] == reportType,
         'Download report type is Actual : {} and Expected : {}'.format(
             str(dcrResponse['downloadReportType']), str(reportType)))
     Assertion.constructAssertion(
         dcrResponse['couponSeriesId'] == couponSeriesId,
         'Requested Coupon series Id  is Mismatch Actual : {} and Expected : {}'
         .format(str(dcrResponse['couponSeriesId']), str(couponSeriesId)))
     DracarysHelper.getDownloadStatusAndAssertion(self, couponSeriesId,
                                                  dcrResponse['jobId'],
                                                  reportType, couponCode)
Beispiel #29
0
 def test_executeTierDowngradeForOrgAtTime(self):
     billingTime = Utils.getTime(days=-120, dateTimeFormat=True)
     txBody = {
         "root": {
             "transaction": {
                 "amount": "6000",
                 "billing_time": billingTime,
                 "gross_amount": "6000"
             }
         }
     }
     txObj = InTouchAPI(Transaction.Add(body=txBody))
     custObj = InTouchAPI(Customer.Get({'mobile': txObj.params['mobile']}))
     currentSlab = custObj.response['response']['customers']['customer'][0][
         'current_slab']
     Assertion.constructAssertion(
         currentSlab == 'Gold',
         'Current Slab Should be Gold before Tier Downgrade')
     firstDayofMonth = Utils.getFirstDayofMonth(milliSeconds=True)
     self.connObj.executeTierDowngradeForOrgAtTime(self.orgId,
                                                   firstDayofMonth, True,
                                                   True)
     custObj = InTouchAPI(Customer.Get({'mobile': txObj.params['mobile']}))
     currentSlab = custObj.response['response']['customers']['customer'][0][
         'current_slab']
     Assertion.constructAssertion(
         currentSlab == 'Silver',
         'Current Slab Should be Silver after Tier Downgrade')
 def test_LUCI_RC_DCP_018_sanity(self, description):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self,
         couponConfigReq={
             'client_handling_type': 'DISC_CODE_PIN',
             'multiple_use': True,
             'same_user_multiple_redeem': True,
             'do_not_resend_existing_voucher': True,
             'allow_multiple_vouchers_per_user': True,
             'max_redemptions_in_series_per_user': 2
         })
     couponCode = LuciHelper.uploadCouponAndAssertions(
         self, couponSeriesId,
         self.constructObj.importType['NONE'])['coupons'][0]
     LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
     couponDetails = LuciHelper.redeemCouponAndAssertions(self,
                                                          couponSeriesId,
                                                          couponCode,
                                                          isRedeem=False)
     CouponRedemptionCount = couponDetails['redemptionCountDetails'][
         0].__dict__
     Assertion.constructAssertion(
         CouponRedemptionCount['redemptionCount'] == 1,
         'Coupon Redemption Count Actual: {} and Expected: {}'.format(
             CouponRedemptionCount['redemptionCount'], 1))
     Assertion.constructAssertion(
         CouponRedemptionCount['userId'] == self.userId,
         'Redemption userId Actual: {} and Expected: {}'.format(
             CouponRedemptionCount['userId'], self.userId))
     LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)