def assertCommunicationDetailInErrorState(groupVersionId, communicationId): for _ in range(10): time.sleep(30) try: social_info( groupVersionid=groupVersionId, messageId=communicationId).veneno_monitoringStatus() break except Exception, exp: Logger.log('Monitoring Status Still Not Updated')
def waitForSocial(self): sleep = 35 if self.socialAdsetInfo: sleep = 100 if constant.config['cluster'] not in ['nightly', 'staging']: Logger.log( 'In Prod , Veneno Monitor Status takes 10 mins , so waiting for 1 mins -10 times to start DB Assertion....' ) sleep = sleep + 70 for _ in range(15): try: Logger.log('Checking For Value in SocialAdset Table') if self.socialAdsetInfo: social_info(groupVersionid=self.groupVersionId, messageId=self.messageId, socialAdsetInfo=True).socialInfo else: social_info( groupVersionid=self.groupVersionId, messageId=self.messageId).veneno_monitoringStatus() break except Exception, exp: time.sleep(sleep)
def __init__(self, campaignId, groupVersionId, cdId, listCount, couponUsed=False, couponUsedExteranal=False, skippedUsers=False, skippedReason=[], socialAudienceList=True, socialAdsetInfo=True, aggregationDetail=True, venenoInfo=True, venenoDataDetailsInfo=True, socialOffer=False, externalOfferList=[]): Logger.log( 'Social Db Assertion Initialized for Value ... GroupVersionId :{} and Messageid :{}' .format(groupVersionId, cdId)) self.campaignId = campaignId self.groupVersionId = groupVersionId self.messageId = cdId self.listCount = listCount self.skippedUsers = skippedUsers self.skippedReason = skippedReason self.couponUsed = couponUsed self.couponUsedExteranal = couponUsedExteranal self.socialAudienceList = socialAudienceList self.socialAdsetInfo = socialAdsetInfo self.aggregationDetail = aggregationDetail self.venenoInfo = venenoInfo self.venenoDataDetailsInfo = venenoDataDetailsInfo self.socialOffer = socialOffer self.externalOfferList = externalOfferList self.waitForSocial() self.SocialInfo = social_info( groupVersionid=groupVersionId, messageId=cdId, socialAudienceList=socialAudienceList, socialAdsetInfo=socialAdsetInfo, aggregationDetail=aggregationDetail, venenoInfo=venenoInfo, venenoDataDetailsInfo=venenoDataDetailsInfo, socialOffer=socialOffer).socialInfo
def assertAggregationDetailAndAudienceListCreated(groupVersionId, communicationId): socialInfo = social_info(groupVersionid=groupVersionId, messageId=communicationId, aggregationDetail=True, socialAudienceList=True).socialInfo Assertion.constructAssertion( socialInfo['audienceList']['message_id'] == communicationId, 'Social Audience List is Published') Assertion.constructAssertion('LIST_DELETE' in socialInfo['aggregationDetails'], 'LIST_DELETE in aggregation Details', verify=True) Assertion.constructAssertion('LIST_PUBLISHED' in socialInfo['aggregationDetails'], 'LIST_PUBLISHED in aggregation Details', verify=True) Assertion.constructAssertion('POST_PROCESS' in socialInfo['aggregationDetails'], 'POST_PROCESS in aggregation Details', verify=True)
def assertCreateCustomList(groupVersionid, messageId, CreateCustomAudienceListResponse, name, description, type='FACEBOOK'): socialAudienceListInfo = \ social_info(groupVersionid=groupVersionid, messageId=messageId, socialAudienceList=True).socialInfo[ 'audienceList'] Assertion.constructAssertion( socialAudienceListInfo['type'] == type.upper(), 'Audience List Type , Actual :{} and Expected :{}'.format( socialAudienceListInfo['type'], type.upper())) Assertion.constructAssertion( int(socialAudienceListInfo['account_id']) == constant.config['facebook']['accountId'], 'AccountId , Actual :{} and Expected :{}'.format( socialAudienceListInfo['account_id'], constant.config['facebook']['accountId'])) Assertion.constructAssertion( socialAudienceListInfo['remote_list_id'] == CreateCustomAudienceListResponse.listid, 'Remote List Id , Actual :{} and Expected :{}'.format( socialAudienceListInfo['remote_list_id'], CreateCustomAudienceListResponse.listid)) Assertion.constructAssertion( socialAudienceListInfo['name'] == name, 'Name of List , Actual :{} and Expected :{}'.format( socialAudienceListInfo['name'], name)) Assertion.constructAssertion( socialAudienceListInfo['description'] == description, 'Description of List , Actual :{} and Expected :{}'.format( socialAudienceListInfo['description'], description)) Assertion.constructAssertion( socialAudienceListInfo['approximate_count'] >= 0, 'approximate_count of List,Expected to Be greater than or equal to 0' )
return ckvId @staticmethod def assertCommunicationDetailInErrorState(groupVersionId, communicationId): for _ in range(10): time.sleep(30) try: social_info( groupVersionid=groupVersionId, messageId=communicationId).veneno_monitoringStatus() break except Exception, exp: Logger.log('Monitoring Status Still Not Updated') time.sleep(30) cdState = social_info( groupVersionid=groupVersionId, messageId=communicationId).veneno_communicationDetails()['state'] Assertion.constructAssertion( cdState == 'ERROR', 'Check CD State is Error as remote Campaign Id is not set') @staticmethod def assertAggregationDetailAndAudienceListCreated(groupVersionId, communicationId): socialInfo = social_info(groupVersionid=groupVersionId, messageId=communicationId, aggregationDetail=True, socialAudienceList=True).socialInfo Assertion.constructAssertion( socialInfo['audienceList']['message_id'] == communicationId, 'Social Audience List is Published')