Exemplo n.º 1
0
    def validateGroupStatusAsync_response(audiencecGroupEntity, status,
                                          audienceType):
        Assertion.constructAssertion(
            audiencecGroupEntity['status'] ==
            campaignShardObject().AudienceGroupStatus[status],
            'Status In Response :{} and Expected :{}'.format(
                audiencecGroupEntity['status'], status))
        for eachExpectedResult in [('customerCount', 0), ('controlCount', 0),
                                   ('reachabilityStatus', None),
                                   ('versionNumber', 0), ('testCount', 0)]:
            Assertion.constructAssertion(
                audiencecGroupEntity[
                    eachExpectedResult[0]] == eachExpectedResult[1],
                'Actual Value of :{} is :{} and expected is :{}'.format(
                    eachExpectedResult[0],
                    audiencecGroupEntity[eachExpectedResult[0]],
                    eachExpectedResult[1]))

        Assertion.constructAssertion(
            audiencecGroupEntity['versionId'] is not None,
            'Group Version id is :{} and Expected in NULL'.format(
                audiencecGroupEntity['versionId']))
        Assertion.constructAssertion(
            audiencecGroupEntity['type'] ==
            campaignShardObject().CampaignGroupType[audienceType],
            'Type in Actual is :{} and passed:{}'.format(
                audiencecGroupEntity['type'], audienceType))
        Assertion.constructAssertion(
            audiencecGroupEntity['orgId'] == constant.config['orgId'],
            'OrgId is :{}'.format(constant.config['orgId']))
        if audienceType == 'FILTER_BASED':
            Assertion.constructAssertion(
                audiencecGroupEntity['uuId'] is not None, 'UUID is not None')
Exemplo n.º 2
0
    def validateGroupStatusAsync_database_groupDetails(audiencecGroupEntity):
        groupDetailsInfo = dbCallsList.getGroupDetailsWithListId(
            audiencecGroupEntity['id'])

        for eachGroupMetaEntry in ['uuId', 'orgId']:  #'description'
            Assertion.constructAssertion(
                audiencecGroupEntity[eachGroupMetaEntry] ==
                groupDetailsInfo[eachGroupMetaEntry],
                'For :{} , Actual :{} and expected :{}'.format(
                    eachGroupMetaEntry,
                    audiencecGroupEntity[eachGroupMetaEntry],
                    groupDetailsInfo[eachGroupMetaEntry]))
        Assertion.constructAssertion(
            audiencecGroupEntity['type'] ==
            campaignShardObject().CampaignGroupType[groupDetailsInfo['type']],
            'Type in Response :{} and in DB :{}'.format(
                audiencecGroupEntity['type'], groupDetailsInfo['type']))
        Assertion.constructAssertion(
            groupDetailsInfo['is_visible'] == 1,
            'Is_visible in DB :{} and expected is 1'.format(
                groupDetailsInfo['type']))
        Assertion.constructAssertion(
            audiencecGroupEntity['label'] == groupDetailsInfo['label'],
            'label in Response and in DB :{}'.format(
                audiencecGroupEntity['label'], groupDetailsInfo['label']))
    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.º 4
0
 def setup_class(self):
     testControlTypeSupported = ['org', 'skip', 'custom']
     listSupported = ['filter', 'upload']
     Logger.logSuiteName(str(self).split('.')[-1])
     self.campaignShardObject = campaignShardObject()
     self.intialUsedObject = copy.deepcopy(
         constant.thiriftCampaignShardTestReferenceObject)
     CampaignShardHelper.setupCampaignsInThriftReference(
         typesOfCampaign=testControlTypeSupported)
     CampaignShardHelper.setupListInThriftReference(
         listSupported, typesOfCampaign=testControlTypeSupported)
Exemplo n.º 5
0
 def setupListInThriftReference(typesOfList,
                                typesOfCampaign=['org', 'skip', 'custom'],
                                numberOfList=['A', 'B']):
     campaignShardObjectRef = campaignShardObject()
     for eachCampaignType in typesOfCampaign:
         campaignName = constant.thiriftCampaignShardTestReferenceObject[
             eachCampaignType.lower()]['campaign']['name']
         campaignId = constant.thiriftCampaignShardTestReferenceObject[
             eachCampaignType.lower()]['campaign']['id']
         for eachList in typesOfList:
             for nameOfFilterLists in numberOfList:
                 connObj = CampaignShardHelper.getConnObj(
                     newConnection=True)
                 if 'filter' in eachList:
                     CampaignShardHelper.setupFilterList(
                         eachCampaignType, campaignName, campaignId,
                         nameOfFilterLists)
                 if 'upload' in eachList:
                     CampaignShardHelper.setupUploadList(
                         eachCampaignType, campaignName, campaignId,
                         nameOfFilterLists)
                 if 'split' in eachList:
                     CampaignShardHelper.setupSplitList(
                         connObj, campaignShardObjectRef, eachCampaignType,
                         campaignName, campaignId)
                 if 'merge' in eachList:
                     CampaignShardHelper.setupMergeList(
                         connObj, campaignShardObjectRef, eachCampaignType,
                         campaignName, campaignId)
                 if 'duplicate' in eachList:
                     CampaignShardHelper.setupDuplicateList(
                         connObj, campaignShardObjectRef, eachCampaignType,
                         campaignName, campaignId)
                 if 'dedup' in eachList:
                     CampaignShardHelper.setupDedupList(
                         connObj, campaignShardObjectRef, eachCampaignType,
                         campaignName, campaignId)