コード例 #1
0
    def test_socialThrift_getAdset_Sanity(self, socialStatus):
        adsetName = 'Auto_AdsetName_{}'.format(int(time.time() * 1000))
        SocialAdsetInfo = self.connObj.createSocialAdset(
            constant.config['orgId'],
            SocialObject().SocialChannel['facebook'],
            SocialObject.SocialAdsetInfo(
                adsetName,
                self.remoteCampaignId,
                datetime.fromtimestamp(
                    time.time()).strftime('%Y-%m-%dT%H:%M:%S'),
                datetime.fromtimestamp(time.time() + 25 * 60 *
                                       60).strftime('%Y-%m-%dT%H:%M:%S'),
                socialStatus,
                100000,
                customAudienceId=self.remoteListId),
            'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                           1000)))

        SocialAdSets = self.connObj.getAdSets(
            SocialObject().SocialChannel['facebook'], constant.config['orgId'],
            'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                           1000)))

        SocialHelper.assertGetAdset(SocialAdSets, SocialAdsetInfo,
                                    SocialObject().SocialStatus[socialStatus])
コード例 #2
0
 def test_socialThrift_createCustomList_withSameIdMultipleTimes(
         self, numberOfUsers, identifier, listName, description, channel,
         testControlType):
     groupVersionid, groupName = SocialHelper.createListForSocial(
         self.campaigns, testControlType)
     messageId = SocialHelper.createMessageForThriftHelp(
         self.campaigns[testControlType], groupVersionid, numberOfUsers,
         groupName)
     listName = listName.format(identifier, testControlType,
                                int(time.time() * 1000))
     preCreatedListId = None
     for _ in range(2):
         CreateCustomAudienceListResponse = self.connObj.createCustomList(
             SocialHelper.createUserListObject(numberOfUsers, identifier),
             SocialObject.CustomAudienceListDetails(listName, description,
                                                    messageId),
             SocialObject.SocialAccountDetails(channel),
             constant.config['orgId'], str(groupVersionid),
             'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000)))
         SocialHelper.assertCreateCustomList(
             groupVersionid, messageId, CreateCustomAudienceListResponse,
             listName, description)
         if preCreatedListId is None:
             preCreatedListId = CreateCustomAudienceListResponse.listid
         else:
             SocialHelper.assertRemoteListIds(
                 preCreatedListId, CreateCustomAudienceListResponse.listid)
コード例 #3
0
    def test_socialThrift_integrateOfCreateAndGetList(self, numberOfUsers,
                                                      identifier, listName,
                                                      description, channel,
                                                      testControlType):
        groupVersionid, groupName = SocialHelper.createListForSocial(
            self.campaigns, testControlType)
        messageId = SocialHelper.createMessageForThriftHelp(
            self.campaigns[testControlType], groupVersionid, numberOfUsers,
            groupName)
        listName = listName.format(identifier, testControlType,
                                   int(time.time() * 1000))
        CreateCustomAudienceListResponse = self.connObj.createCustomList(
            SocialHelper.createUserListObject(numberOfUsers, identifier),
            SocialObject.CustomAudienceListDetails(listName, description,
                                                   messageId),
            SocialObject.SocialAccountDetails(channel),
            constant.config['orgId'],
            str(groupVersionid), 'requestId_automationthriftCall_{}'.format(
                int(time.time() * 1000)))
        Logger.log('Create Audience List , Response Message :{}'.format(
            CreateCustomAudienceListResponse.message))

        GetCustomAudienceListsResponse = self.connObj.getCustomAudienceLists(
            constant.config['orgId'],
            SocialObject().SocialChannel['facebook'],
            True, 'requestId_automationthriftCall_{}'.format(
                int(time.time() * 1000)))
        Logger.log('Message From Get Custom Audience List : {}'.format(
            GetCustomAudienceListsResponse.message))
        SocialHelper.assertNewCreatedListInGetCall(
            listName, GetCustomAudienceListsResponse)
コード例 #4
0
 def createRemoteCampaignsForSocialThrift(campaignId):
     connObj = SocialHelper.getConnObj(newConnection=True)
     return connObj.createCampaign(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         SocialObject.SocialCampaign(
             'SocialCampaign_{}'.format(int(time.time() * 1000)),
             constant.config['orgId'],
             campaignId), 'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000))).remoteCampaignId
コード例 #5
0
 def createUserListObject(numberOfUsers, identifier='mobile'):
     userDetail = social_user_calls().getUsersInformation(
         numberOfUsers, identifier)
     listOfUserDetails = list()
     for eachUser in userDetail:
         if identifier == 'mobile':
             listOfUserDetails.append(
                 SocialObject.UserDetails(mobile=eachUser))
         if identifier == 'email':
             listOfUserDetails.append(
                 SocialObject.UserDetails(email=eachUser))
     return listOfUserDetails
コード例 #6
0
 def test_socialThrift_createCampaign_Sanity(self, socialStatus):
     SocialCampaign = self.connObj.createCampaign(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         SocialObject.SocialCampaign('SocialCampaign_{}'.format(
             int(time.time() * 1000)),
                                     constant.config['orgId'],
                                     self.campaigns['ORG'],
                                     socialCampaignStatus=socialStatus),
         'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                        1000)))
     SocialHelper.assertCreateCampaignForSocial(self.campaigns['ORG'],
                                                SocialCampaign)
コード例 #7
0
 def createRemoteListForSocialThrift(campaigns):
     groupVersionid, groupName = SocialHelper.createListForSocial(
         campaigns, 'ORG')
     messageId = SocialHelper.createMessageForThriftHelp(
         campaigns['ORG'], groupVersionid, 5, groupName)
     connObj = SocialHelper.getConnObj(newConnection=True)
     return connObj.createCustomList(
         SocialHelper.createUserListObject(5),
         SocialObject.CustomAudienceListDetails(
             'remoteList_testAdset_{}'.format(int(time.time())),
             'Test Create Adset', messageId),
         SocialObject.SocialAccountDetails('facebook'),
         constant.config['orgId'],
         str(groupVersionid), 'requestId_automationthriftCall_{}'.format(
             int(time.time() * 1000))).listid, groupVersionid
コード例 #8
0
 def test_socialThrift_testAccount_Sanity(self):
     testAccountResponse = self.connObj.testAccount(
         SocialObject().SocialChannel['facebook'], constant.config['orgId'],
         'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                        1000)))
     Assertion.constructAssertion(
         testAccountResponse,
         'Response for TestAccount :{}'.format(testAccountResponse))
コード例 #9
0
ファイル: test_thrift_adset.py プロジェクト: anupsl/pyApps
 def test_socialThrift_getSocialCampaignDetails_Sanity(self):
     campaignId = social_user_calls().getCampaignIdWithRemoteId()
     SocialCampaignDetails = self.connObj.getSocialCampaignDetails(
         constant.config['orgId'], campaignId,
         int(constant.config['userId']),
         SocialObject().SocialChannel['facebook'],
         'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                        1000)))
     SocialHelper.validateGetSoicalCampaignDetails(SocialCampaignDetails,
                                                   campaignId)
コード例 #10
0
 def test_socialThrift_getCustomAudienceLists_Sanity(self):
     GetCustomAudienceListsResponse = self.connObj.getCustomAudienceLists(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         True, 'requestId_automationthriftCall_{}'.format(
             int(time.time() * 1000)))
     Logger.log('Message From Get Custom Audience List : {}'.format(
         GetCustomAudienceListsResponse.message))
     SocialHelper.assertGetCustomAudienceList(
         GetCustomAudienceListsResponse)
コード例 #11
0
 def test_socialThrift_updateCustomListInAdset_Sanity(self):
     remoteAdsetId = social_user_calls().getRemoteAdset()
     remoteListId = social_user_calls().getRemoteListId()
     SocialAdsetInfo = self.connObj.updateCustomListInAdset(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'], remoteAdsetId,
         remoteListId, 'requestId_automationthriftCall_{}'.format(
             int(time.time() * 1000)))
     SocialHelper.validateSocialAdsetInfo(SocialAdsetInfo, remoteAdsetId,
                                          remoteListId)
コード例 #12
0
ファイル: test_thrift_adset.py プロジェクト: anupsl/pyApps
 def test_socialThrift_getSocialCampaignDetails_withInvalidUserId(self):
     try:
         SocialCampaignDetails = self.connObj.getSocialCampaignDetails(
             constant.config['orgId'], self.campaignId['ORG'], 99999,
             SocialObject().SocialChannel['facebook'],
             'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000)))
         Assertion.constructAssertion(
             False, 'Thrift Call still working with Invalid UserId')
     except Exception, exp:
         Logger.log('With Invalid User Exception Caught :{}'.format(exp))
コード例 #13
0
 def test_thrift_createNativeOffer_without_socialOfferCouponsCsvFileInfo_Sanity(
         self, offerType, offerValue, socialCouponType):
     SocialOffer = self.connObj.createNativeOffer(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         SocialObject.SocialOffer(
             {
                 'offerType': offerType,
                 'offerText': 'offerText_{}'.format(int(time.time())),
                 'offerValue': offerValue,
                 'socialOfferCouponsCsvFileInfo': None,
                 'redemptionCode': 'redemptionCode_{}'.format(
                     int(time.time()))
             }, constant.config['facebook']['pageId'],
             SocialObject().OfferLocationType['offline'],
             'overviewDetails_{}'.format(int(time.time())),
             datetime.fromtimestamp(time.time() + 25 * 60 *
                                    60).strftime('%Y-%m-%dT%H:%M:%S'),
             socialCouponType), 'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000)))
     SocialHelper.assertOfferCreation(SocialOffer)
コード例 #14
0
	def checkRemoteAdset(self):
		connObj = SocialHelper.getConnObj(newConnection=True)
		flag = False
		SocialAdSets = connObj.getAdSets(
			SocialObject().SocialChannel['facebook'],
			constant.config['orgId'],
			'requestId_automationthriftCall_{}'.format(int(time.time()*1000))
		)
		
		for SocialAdSet in SocialAdSets:
		    if SocialAdSet.id == self.remoteAdsetId:
		        flag=True
		        break
		Assertion.constructAssertion(flag,'SocialAdsetInfo remoteId found in getSocialAdset')
コード例 #15
0
 def test_socialThrift_createCustomList_WithDifferentTestControlType(
         self, numberOfUsers, identifier, listName, description, channel,
         testControlType):
     groupVersionid, groupName = SocialHelper.createListForSocial(
         self.campaigns, testControlType)
     messageId = SocialHelper.createMessageForThriftHelp(
         self.campaigns[testControlType], groupVersionid, numberOfUsers,
         groupName)
     listName = listName.format(identifier, testControlType,
                                int(time.time() * 1000))
     CreateCustomAudienceListResponse = self.connObj.createCustomList(
         SocialHelper.createUserListObject(numberOfUsers, identifier),
         SocialObject.CustomAudienceListDetails(listName, description,
                                                messageId),
         SocialObject.SocialAccountDetails(channel),
         constant.config['orgId'],
         str(groupVersionid), 'requestId_automationthriftCall_{}'.format(
             int(time.time() * 1000)))
     Logger.log('Create Audience List , Response Message :{}'.format(
         CreateCustomAudienceListResponse.message))
     SocialHelper.assertCreateCustomList(groupVersionid, messageId,
                                         CreateCustomAudienceListResponse,
                                         listName, description)
コード例 #16
0
    def test_socialThrift_deleteSocialAudienceList(self):
        GetCustomAudienceListsResponse = self.connObj.getCustomAudienceLists(
            constant.config['orgId'],
            SocialObject().SocialChannel['facebook'],
            True, 'requestId_automationthriftCall_{}'.format(
                int(time.time() * 1000)))

        for eachList in GetCustomAudienceListsResponse.customAudienceLists:
            firstListFromGetAudienceList = eachList.remoteListId
            self.connObj.deleteSocialAudienceList(
                SocialObject().SocialChannel['facebook'],
                constant.config['orgId'], firstListFromGetAudienceList,
                'requestId_automationthriftCall_{}'.format(
                    int(time.time() * 1000)))

            GetCustomAudienceListsResponseForEach = self.connObj.getCustomAudienceLists(
                constant.config['orgId'],
                SocialObject().SocialChannel['facebook'], True,
                'requestId_automationthriftCall_{}'.format(
                    int(time.time() * 1000)))
            SocialHelper.assertDeleteSocialAudienceList(
                GetCustomAudienceListsResponseForEach,
                firstListFromGetAudienceList)
コード例 #17
0
 def test_socialThrift_updateCustomListInAdset_WithIncorrectAdsetId(self):
     remoteListId = social_user_calls().getRemoteListId()
     try:
         SocialAdsetInfo = self.connObj.updateCustomListInAdset(
             constant.config['orgId'],
             SocialObject().SocialChannel['facebook'], 'remoteAdsetId',
             remoteListId, 'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000)))
         Assertion.constructAssertion(
             False, 'Wrong Remote AdsetId is Getting Accepted')
     except Exception, exp:
         Logger.log(
             'With Wrong Adset Id , Exception from thrift Call :{}'.format(
                 exp))
コード例 #18
0
	def checkRemoteList(self):
		connObj = SocialHelper.getConnObj(newConnection=True)
		flag=False
		
		GetCustomAudienceListsResponse = connObj.getCustomAudienceLists(
		    constant.config['orgId'],
		    SocialObject().SocialChannel['facebook'],
		    True,
		    'requestId_automationthriftCall_{}'.format(int(time.time()*1000))
		)
		for each in GetCustomAudienceListsResponse.customAudienceLists:
		    if each.remoteListId == self.remoteListId:
		        flag = True
		        break
		Assertion.constructAssertion(flag,'New Created List with Name :{} found in GetCustomAudienceListsResponse'.format(self.remoteListId))
コード例 #19
0
ファイル: test_thrift_adset.py プロジェクト: anupsl/pyApps
 def test_socialThrift_createAdset_withList_withoutCouponAttached_Sanity(
         self, socialStatus):
     adsetName = 'Auto_AdsetName_{}'.format(int(time.time() * 1000))
     SocialAdsetInfo = self.connObj.createSocialAdset(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         SocialObject.SocialAdsetInfo(
             adsetName,
             self.remoteCampaignId,
             datetime.fromtimestamp(
                 time.time()).strftime('%Y-%m-%dT%H:%M:%S'),
             datetime.fromtimestamp(time.time() + 25 * 60 *
                                    60).strftime('%Y-%m-%dT%H:%M:%S'),
             socialStatus,
             100000,
             customAudienceId=self.remoteListId),
         'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                        1000)))
     SocialHelper.assertCreateAdsetSocial(
         SocialAdsetInfo,
         self.remoteCampaignId,
         SocialObject().SocialStatus[socialStatus.upper()],
         adsetName,
         expectedRemoteListId=self.remoteListId)
コード例 #20
0
ファイル: test_thrift_adset.py プロジェクト: anupsl/pyApps
 def test_socialThrift_getSocialCampaignDetails_withCampaignNoRemoteId(
         self):
     try:
         SocialCampaignDetails = self.connObj.getSocialCampaignDetails(
             constant.config['orgId'], self.campaignId['ORG'],
             int(constant.config['userId']),
             SocialObject().SocialChannel['facebook'],
             'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000)))
         Assertion.constructAssertion(
             False,
             'With Campaign Not mapped with remote Campaign id , also thrift call worked'
         )
     except Exception, exp:
         Logger.log(
             'With Campaign Not mapped with remote Campaign id Exception Caught :{}'
             .format(exp))
コード例 #21
0
ファイル: test_thrift_adset.py プロジェクト: anupsl/pyApps
 def test_socialThrift_createAdset_withList_withCouponAttached(
         self, socialStatus):
     adsetName = 'Auto_AdsetName_{}'.format(int(time.time() * 1000))
     SocialOffer = self.connObj.createNativeOffer(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         SocialObject.SocialOffer(
             {
                 'offerType': 'percentage_off',
                 'offerText': 'offerText_{}'.format(int(time.time())),
                 'offerValue': 10,
                 'socialOfferCouponsCsvFileInfo': None,
                 'redemptionCode': 'redemptionCode_{}'.format(
                     int(time.time()))
             }, constant.config['facebook']['pageId'],
             SocialObject().OfferLocationType['offline'],
             'overviewDetails_{}'.format(int(time.time())),
             datetime.fromtimestamp(time.time() + 25 * 60 *
                                    60).strftime('%Y-%m-%dT%H:%M:%S'),
             'generic'), 'requestId_automationthriftCall_{}'.format(
                 int(time.time() * 1000)))
     SocialAdsetInfo = self.connObj.createSocialAdset(
         constant.config['orgId'],
         SocialObject().SocialChannel['facebook'],
         SocialObject.SocialAdsetInfo(
             adsetName,
             self.remoteCampaignId,
             datetime.fromtimestamp(
                 time.time()).strftime('%Y-%m-%dT%H:%M:%S'),
             datetime.fromtimestamp(time.time() + 25 * 60 *
                                    60).strftime('%Y-%m-%dT%H:%M:%S'),
             socialStatus,
             100000,
             customAudienceId=self.remoteListId,
             remoteOfferId=SocialOffer.remoteOfferId),
         'requestId_automationthriftCall_{}'.format(int(time.time() *
                                                        1000)))
     SocialHelper.assertCreateAdsetSocial(
         SocialAdsetInfo,
         self.remoteCampaignId,
         SocialObject().SocialStatus[socialStatus.upper()],
         adsetName,
         expectedRemoteListId=self.remoteListId)