Esempio n. 1
0
 def test_pasteList_sameName_SequentialRequest(self):
     response, payload, campaignId = campaignList.createList({'name':'IRIS_SEQUENTIAL_REQUEST' + str(int(time.time() * 100000))})
     campaignList.assertCreateList(response, 200)
     groupVersionDetailResult, bucketId = campaignList.assertCreateListDbCalls(response.get('json').get('entity').get('listId'), payload, 'ORG')
     Logger.log('First List Created with CampaignId : {} having GroupVersionId : {}, bucketId : {}'.format(campaignId, groupVersionDetailResult, bucketId))
     response, payload, campaignId = campaignList.createList({'name':payload.get('name')}, campaignId=campaignId)
     campaignList.assertCreateList(response, 400, 2006, 'List Name Exception : List Name already exists')
Esempio n. 2
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()
Esempio n. 3
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     nsPort = constant.config['nsMasterPort']
     self.nsHelper = NSAdminHelper(constant.config['orgId'], 'SMS')
     luciPort = constant.config['luciPort'].next()
     self.luciObj = LuciThrift(luciPort)
     self.constructObj = LuciObject()
     constant.config['requestId'] = 'requestId_IRIS_LUCI'
     createListresponse, createListPayload, campaignId = campaignList.createList({'customTagCount':0, 'name':'IRIS_LIST_' + str(int(time.time() * 100000))}, campaignType=['LIVE', 'ORG', 'List', 'TAGS', 0])
     campaignList.assertCreateList(createListresponse, 200)
     groupVersionDetailResult, bucketId = campaignList.assertCreateListDbCalls(createListresponse['json']['entity']['listId'], createListPayload, 'ORG')
     Logger.log('GroupVersionId : {}, bucketId : {}'.format(groupVersionDetailResult, bucketId))
     addRecipientResponse, addRecipientPayload = campaignList.addRecipient({}, campaignId, createListresponse['json']['entity']['listId'], 'mobile', 10, 0, newUser=False)
     campaignList.assertAddRecipient(addRecipientResponse, 200)
     campaignList.assertAddRecipientDbCalls(addRecipientResponse, addRecipientPayload, createListresponse, campaignId, bucketId, {'TEST':groupVersionDetailResult['TEST'], 'CONTROL':groupVersionDetailResult['CONTROL']}, 'mobile')
     self.bucketId = bucketId
     self.groupVersionResult = dbCallsList.getGroupVersionDetailsWithGroupId(createListresponse['json']['entity']['listId'])
     responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(campaignId=campaignId)
     self.strategy = construct.constructStrategyIds()
     self.programeId = self.strategy['programeId']
     self.allocationStrategyId = self.strategy['allocationStrategyId']
     self.expiryStrategyId = self.strategy['expirationStrategyId']
     if 'errors' not in responseCoupon['json']:
         self.voucherId = responseCoupon['json']['entity']['voucherSeriesId']
     else:
         self.voucherId = dbCallsCoupons.getVoucherSeriesIdUsingCampaignId(campaignId)
     self.campaignId = campaignId
     self.listId = createListresponse['json']['entity']['listId']
     Logger.log('Using CampaignId : {} , listId : {} for Execution of Create Message'.format(self.campaignId, self.listId))
Esempio n. 4
0
    def preRequisitesForVenenoLine(testControlType='org'):
        userData = []
        for eachUser in constant.config['line']['user']:
            userData.append('Test,Automation,{}'.format(eachUser['userId']))
        campaignResponse, campaignPayload = campaigns.createCampaign({
            'name':
            'IRIS_' + str(int(time.time() * 100000)),
            'goalId':
            constant.irisGenericValues['goalId'],
            'objectiveId':
            constant.irisGenericValues['objectiveId'],
            'testControl': {
                'type': testControlType.upper(),
                'test': 90
            }
        })
        listResponse, listPayload, campaignId = campaignList.createList(
            {
                'customTagCount': 0,
                'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
            },
            campaignId=campaignResponse['json']['entity']['campaignId'])
        addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
            {
                'data': userData,
                'schema': 'firstName,lastName,userId'
            },
            campaignId,
            listResponse['json']['entity']['listId'],
            newUser=False)
        responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
            campaignId=campaignId)

        return {
            'campaignName':
            campaignPayload['name'],
            'campaignId':
            campaignId,
            'listId':
            listResponse['json']['entity']['listId'],
            'voucherId':
            responseCoupon['json']['entity']['voucherSeriesId'],
            'strategy':
            None,
            'programeId':
            None,
            'allocationStrategyId':
            None,
            'expiryStrategyId':
            None,
            'bucketId':
            dbCallsList.getGroupVersionDetailsWithGroupId(
                listResponse['json']['entity']['listId'])['TEST']['bucket_id'],
            'groupVersionResult':
            dbCallsList.getGroupVersionDetailsWithGroupId(
                listResponse['json']['entity']['listId']),
            'groupName':
            listPayload['name']
        }
Esempio n. 5
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)
Esempio n. 6
0
    def setup_class(self):
        if 'storeType' in constant.payload['createmessage']:
            constant.payload['createmessage'].pop('storeType')

        campaignResponse, campaignPayload = campaigns.createCampaign({
            'name':
            'IRIS_' + str(int(time.time() * 100000)),
            'goalId':
            constant.irisGenericValues['goalId'],
            'objectiveId':
            constant.irisGenericValues['objectiveId'],
            'testControl': {
                'type': 'ORG',
                'test': 90
            }
        })
        listResponse, listPayload, campaignId = campaignList.createList(
            {
                'customTagCount': 1,
                'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
            },
            campaignId=campaignResponse['json']['entity']['campaignId'])
        addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
            {},
            campaignId,
            listResponse['json']['entity']['listId'],
            'mobile',
            10,
            1,
            newUser=False)
        responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
            campaignId=campaignId)

        self.campaignId = campaignId
        self.listId = listResponse['json']['entity']['listId']
        self.voucherId = responseCoupon['json']['entity']['voucherSeriesId']
        self.strategy = construct.constructStrategyIds()
        self.programeId = self.strategy['programeId']
        self.allocationStrategyId = self.strategy['allocationStrategyId']
        self.expiryStrategyId = self.strategy['expirationStrategyId']
        self.bucketId = dbCallsList.getGroupVersionDetailsWithGroupId(
            listResponse['json']['entity']['listId'])['TEST']['bucket_id']
        self.groupVersionResult = dbCallsList.getGroupVersionDetailsWithGroupId(
            listResponse['json']['entity']['listId'])
        Logger.log(
            'Veneno Setup Details --> campaignId:{} ,ListId:{} ,voucherId:{} ,strategy:{}, bucketId:{}, groupVersionDetail:{}'
            .format(self.campaignId, self.listId, self.voucherId,
                    self.strategy, self.bucketId, self.groupVersionResult))
Esempio n. 7
0
    def preRequisitesForVeneno(testControlType='org'):
        if 'storeType' in constant.payload['createmessage']:
            constant.payload['createmessage'].pop('storeType')

        campaignResponse, campaignPayload = campaigns.createCampaign({
            'name':
            'IRIS_' + str(int(time.time() * 100000)),
            'goalId':
            constant.irisGenericValues['goalId'],
            'objectiveId':
            constant.irisGenericValues['objectiveId'],
            'testControl': {
                'type': testControlType.upper(),
                'test': 90
            }
        })
        listResponse, listPayload, campaignId = campaignList.createList(
            {
                'customTagCount': 1,
                'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
            },
            campaignId=campaignResponse['json']['entity']['campaignId'])
        addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
            {},
            campaignId,
            listResponse['json']['entity']['listId'],
            'mobile,email',
            10,
            1,
            newUser=False)
        responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
            campaignId=campaignId)
        strategyDict = construct.constructStrategyIds()
        groupVersionDict = dbCallsList.getGroupVersionDetailsWithGroupId(
            listResponse['json']['entity']['listId'])

        return {
            'campaignId': campaignId,
            'listId': listResponse['json']['entity']['listId'],
            'voucherId': responseCoupon['json']['entity']['voucherSeriesId'],
            'strategy': strategyDict,
            'programeId': strategyDict['programeId'],
            'allocationStrategyId': strategyDict['allocationStrategyId'],
            'expiryStrategyId': strategyDict['expirationStrategyId'],
            'bucketId': groupVersionDict['TEST']['bucket_id'],
            'groupVersionResult': groupVersionDict,
            'groupName': listPayload['name']
        }
Esempio n. 8
0
 def setup_class(self):
     campaignMessage.getWeCRMTemplates()
     self.nonWechatOrgId = construct.updateOrgId(
         constant.config['wechat_org_id'])
     self.templateIdDict = campaignMessage.setupTemplateId()
     createListresponse, createListPayload, campaignId = campaignList.createList(
         {
             'customTagCount': 0,
             'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
         },
         campaignId=Test_Wechat_CreateMessage.createCampaign())
     campaignList.assertCreateList(createListresponse, 200)
     groupVersionDetailResult, bucketId = campaignList.assertCreateListDbCalls(
         createListresponse['json']['entity']['listId'], createListPayload,
         'ORG')
     Logger.log('GroupVersionId : {}, bucketId : {}'.format(
         groupVersionDetailResult, bucketId))
     addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
         Test_Wechat_CreateMessage.addRecipientPayload(), campaignId,
         createListresponse['json']['entity']['listId'])
     campaignList.assertAddRecipient(addRecipientResponse, 200)
     responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
         campaignId=campaignId)
     self.groupVersionResult = dbCallsList.getGroupVersionDetailsWithGroupId(
         createListresponse['json']['entity']['listId'])
     self.bucketId = bucketId
     self.strategy = construct.constructStrategyIds()
     self.programeId = self.strategy['programeId']
     self.allocationStrategyId = self.strategy['allocationStrategyId']
     self.expiryStrategyId = self.strategy['expirationStrategyId']
     self.voucherId = responseCoupon['json']['entity']['voucherSeriesId']
     self.campaignId = campaignId
     self.listId = createListresponse['json']['entity']['listId']
     campaignMessage.updateDefaultMessageJson(self.campaignId, self.listId,
                                              self.voucherId, self.strategy,
                                              self.bucketId,
                                              self.groupVersionResult)
     constant.messagesDefault['updated'] = True
     Logger.log(
         'Using CampaignId : {} , listId : {} for Execution of Create Message'
         .format(self.campaignId, self.listId))
Esempio n. 9
0
 def test_pasteList_lapsedOutboundCampaign(self, testControltype, customTagCount):
     response, payload, campaignId = campaignList.createList({'customTagCount':int(customTagCount), 'name':'IRIS_LIST_' + str(int(time.time() * 100000))}, campaignType=['LAPSED', testControltype, 'List', 'TAGS', customTagCount])
     campaignList.assertCreateList(response, 200)
     groupVersionDetailResult, bucketId = campaignList.assertCreateListDbCalls(response.get('json').get('entity').get('listId'), payload, testControlType=testControltype)
     Logger.log('GroupVersionId : {}, bucketId : {}'.format(groupVersionDetailResult, bucketId))
Esempio n. 10
0
 def test_pasteList_Sanity(self):
     response, payload, campaignId = campaignList.createList()
     campaignList.assertCreateList(response, 200)
     groupVersionDetailResult, bucketId = campaignList.assertCreateListDbCalls(response.get('json').get('entity').get('listId'), payload, 'ORG')
     Logger.log('GroupVersionId : {}, bucketId : {}'.format(groupVersionDetailResult, bucketId))
Esempio n. 11
0
 def test_pasteList_wrongListNames(self, description, listName, errorCode, errorMessage):
     response, payload, campaignId = campaignList.createList({'name':listName})
     campaignList.assertCreateList(response, 400 , errorCode, errorMessage)
Esempio n. 12
0
 def test_pasteList_wrongCampaignId(self, description, campaignId, errorCode, errorMessage):
     response, payload, campaignId = campaignList.createList({}, campaignId=int(campaignId))
     campaignList.assertCreateList(response, 400, errorCode, errorMessage)
Esempio n. 13
0
 def test_pasteList_OutboundCampaign_MoreCustomTagCount(self, testControltype, customTagCount):
     response, payload, campaignId = campaignList.createList({'customTagCount':int(customTagCount), 'name':'IRIS_LIST_' + str(int(time.time() * 100000))}, campaignType=['LAPSED', testControltype, 'List', 'TAGS', customTagCount])
     campaignList.assertCreateList(response, 400, 100, 'Invalid request : Maximum 5 Custom Tags can be given')
Esempio n. 14
0
    def preRequisitesForVenenoMobilePush(commChannelType,
                                         testControlType='org'):
        singleUserProfile = dbCallsAuthorize.getUserForMobilePush(
            commChannelType)[0]
        secondUserProfile = dbCallsAuthorize.getUserForMobilePush(
            commChannelType)[1]
        userData = [
            'Test,Automation,' + str(singleUserProfile['userId']),
            'Test,Automation,' + str(secondUserProfile['userId'])
        ]

        if 'storeType' in constant.payload['createmessage']:
            constant.payload['createmessage'].pop('storeType')

        campaignResponse, campaignPayload = campaigns.createCampaign({
            'name':
            'IRIS_' + str(int(time.time() * 100000)),
            'goalId':
            constant.irisGenericValues['goalId'],
            'objectiveId':
            constant.irisGenericValues['objectiveId'],
            'testControl': {
                'type': testControlType.upper(),
                'test': 90
            }
        })
        listResponse, listPayload, campaignId = campaignList.createList(
            {
                'customTagCount': 0,
                'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
            },
            campaignId=campaignResponse['json']['entity']['campaignId'])
        addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
            {
                'data': userData,
                'schema': 'firstName,lastName,userId'
            },
            campaignId,
            listResponse['json']['entity']['listId'],
            newUser=False)
        responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
            campaignId=campaignId)

        groupVersionDetails = dbCallsList.getGroupVersionDetailsWithGroupId(
            listResponse['json']['entity']['listId'])
        camapignGroupRecipientsData = {
            'TEST':
            dbCallsList.getAllUsersFromCampaignGroupRecipient(
                groupVersionDetails['TEST']['bucket_id'],
                groupVersionDetails['TEST']['id'])
        }
        if 'CONTROL' in groupVersionDetails:
            camapignGroupRecipientsData.update({
                'CONTROL':
                dbCallsList.getAllUsersFromCampaignGroupRecipient(
                    groupVersionDetails['CONTROL']['bucket_id'],
                    groupVersionDetails['CONTROL']['id'])
            })

        return {
            'campaignName':
            campaignPayload['name'],
            'campaignId':
            campaignId,
            'listId':
            listResponse['json']['entity']['listId'],
            'voucherId':
            responseCoupon['json']['entity']['voucherSeriesId'],
            'strategy':
            None,
            'programeId':
            None,
            'allocationStrategyId':
            None,
            'expiryStrategyId':
            None,
            'groupDetails':
            dbCallsList.getGroupDetailsWithListId(
                listResponse['json']['entity']['listId']),
            'campaignGroupRecipient':
            camapignGroupRecipientsData,
            'bucketId':
            groupVersionDetails['TEST']['bucket_id'],
            'groupVersionResult':
            groupVersionDetails,
            'groupName':
            listPayload['name'],
            'addRecipientPayload':
            addRecipientPayload
        }
Esempio n. 15
0
    def preRequisitesForVenenoWechat(userData=[], testControlType='org'):
        if len(userData) == 0:
            for eachUser in constant.config['wechat']['user']:
                userData.append(eachUser['firstName'] + ',' +
                                eachUser['lastName'] + ',' + eachUser['email'])

        if 'storeType' in constant.payload['createmessage']:
            constant.payload['createmessage'].pop('storeType')

        campaignResponse, campaignPayload = campaigns.createCampaign({
            'name':
            'IRIS_' + str(int(time.time() * 100000)),
            'goalId':
            constant.irisGenericValues['goalId'],
            'objectiveId':
            constant.irisGenericValues['objectiveId'],
            'testControl': {
                'type': testControlType.upper(),
                'test': 90
            }
        })
        listResponse, listPayload, campaignId = campaignList.createList(
            {
                'customTagCount': 0,
                'name': 'IRIS_LIST_' + str(int(time.time() * 100000))
            },
            campaignId=campaignResponse['json']['entity']['campaignId'])
        addRecipientResponse, addRecipientPayload = campaignList.addRecipient(
            {
                'data': userData,
                'schema': 'firstName,lastName,email'
            },
            campaignId,
            listResponse['json']['entity']['listId'],
            newUser=False)
        responseCoupon, payloadCoupon, campaignId = coupons.createCoupons(
            campaignId=campaignId)

        groupVersionDetails = dbCallsList.getGroupVersionDetailsWithGroupId(
            listResponse['json']['entity']['listId'])
        camapignGroupRecipientsData = {
            'TEST':
            dbCallsList.getAllUsersFromCampaignGroupRecipient(
                groupVersionDetails['TEST']['bucket_id'],
                groupVersionDetails['TEST']['id'])
        }
        if 'CONTROL' in groupVersionDetails:
            camapignGroupRecipientsData.update({
                'CONTROL':
                dbCallsList.getAllUsersFromCampaignGroupRecipient(
                    groupVersionDetails['CONTROL']['bucket_id'],
                    groupVersionDetails['CONTROL']['id'])
            })

        return {
            'campaignName':
            campaignPayload['name'],
            'campaignId':
            campaignId,
            'listId':
            listResponse['json']['entity']['listId'],
            'voucherId':
            responseCoupon['json']['entity']['voucherSeriesId'],
            'strategy':
            None,
            'programeId':
            None,
            'allocationStrategyId':
            None,
            'expiryStrategyId':
            None,
            'groupDetails':
            dbCallsList.getGroupDetailsWithListId(
                listResponse['json']['entity']['listId']),
            'campaignGroupRecipient':
            camapignGroupRecipientsData,
            'bucketId':
            groupVersionDetails['TEST']['bucket_id'],
            'groupVersionResult':
            groupVersionDetails,
            'groupName':
            listPayload['name'],
            'addRecipientPayload':
            addRecipientPayload
        }