def test_campaignShardThrift_AudienceGroup_Async_CreateAudience_Reload_Sanity(
            self, audienceType):
        createAudienceRequest = campaignShardObject.createAudienceRequest(
            audienceType=audienceType)
        audiencecGroupEntity = self.connObj.createAudienceGroup(
            createAudienceRequest).__dict__
        createAudienceWithGroupId = campaignShardObject.createAudienceRequest(
            {'groupId': audiencecGroupEntity['id']}, audienceType=audienceType)
        createAudienceResponse = self.connObj.createAudience(
            createAudienceWithGroupId).__dict__

        groupDetailsVersionInfo = dbCallsList.getGroupVersionDetailsWithGroupId(
            audiencecGroupEntity['id'])
        s3InfoForUsedList = CampaignShardHelper.getS3Info(
            createAudienceResponse['uuId'])
        thriftCampaignGroup = lambda campaignTargetType: campaignShardObject(
        ).CampaignGroup({
            'groupId':
            audiencecGroupEntity['id'],
            'groupLabel':
            createAudienceResponse['label'],
            'params':
            str(),
            'campaignGroupType':
            'FILTER_BASED',
            'campaignTargetType':
            'TEST',
            'customerCount':
            groupDetailsVersionInfo['TEST']['customer_count'],
            'uuId':
            createAudienceResponse['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))
        userPayloadInfo = CampaignShardHelper.loyaltyUserDataConstructHelper()
        CampaignShardDBAssertion(99999,
                                 'org',
                                 'FILTER_BASED',
                                 createAudienceResponse['label'],
                                 audiencecGroupEntity['id'],
                                 'firstName,lastName,mobile',
                                 userPayloadInfo,
                                 newFlow=True).check()
Exemplo n.º 2
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()