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])
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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)
Exemplo n.º 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
Exemplo n.º 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))
Exemplo n.º 9
0
 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)
Exemplo n.º 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)
 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)
Exemplo n.º 12
0
 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))
Exemplo n.º 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)
Exemplo n.º 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')
Exemplo n.º 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)
Exemplo n.º 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)
 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))
Exemplo n.º 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))
Exemplo n.º 19
0
 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)
Exemplo n.º 20
0
 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))
Exemplo n.º 21
0
 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)