def setup_class(self): self.numberOfUsers = 20 self.constructObj = LuciObject() self.DracarysObj = DracarysObject() self.DracraysConnObj = DracarysHelper.getConnObj(newConnection=True) self.campaigns = SocialHelper.createCampaignsForSocialThrift( testControlType=['ORG']) self.groupVersionid, self.groupName = SocialHelper.createListForSocial( self.campaigns, 'ORG', numberOfUsers=self.numberOfUsers, newUser=True) self.remoteCampaignId = SocialHelper.createRemoteCampaignsForSocialThrift( self.campaigns['ORG']) SocialHelper.updateRemoteCampaignIdInCampaignsBase( self.campaigns['ORG'], self.remoteCampaignId) self.voucherSeriesId = coupons.createCoupons( campaignId=self.campaigns['ORG'], payloadData={ 'couponLimit': { 'limit': 0, 'type': 'UNLIMITED' }, 'discountOn': 'BILL', 'discountType': 'ABS', 'discountValue': 10 })[0]['json']['entity']['voucherSeriesId'] SocialHelper.couponConfigChange( { 'client_handling_type': 'EXTERNAL_ISSUAL', 'any_user': True }, self.campaigns['ORG'], self.voucherSeriesId)
def test_flow_social_skippedWithCouponExpired(self): try: SocialHelper.couponConfigChange( { 'fixedExpiryDate': int(time.time() * 1000 - 24 * 60 * 60 * 1000) }, self.campaigns['ORG'], self.voucherSeriesId) cdDetailsBody = { 'campaignId': self.campaigns['ORG'], 'targetType': 'SOCIAL', 'communicationType': 'FACEBOOK', 'subject': '', 'recipientListId': self.groupVersionid, 'overallRecipientCount': self.numberOfUsers, 'expectedDeliveryCount': self.numberOfUsers, 'groupName': self.groupName } extraParams = { 'voucher_series': self.voucherSeriesId, 'default_argument': { "entity_id": -1, "is_loyalty_checkbox_enabled": "0", "voucher_series_id": self.voucherSeriesId, "daily_budget": 10000, "create_adset": True, "use_existing_adset": False, "adset_name": 'AutoAdset_{}'.format(int(time.time() * 1000)) } } communicationDetailObject = VenenoObject.communicationDetail( cdDetailsBody, extraParams=extraParams) communicationId = self.connObj.addMessageForRecipients( communicationDetailObject) SocialDBAssertion(self.campaigns['ORG'], self.groupVersionid, communicationId, self.numberOfUsers, couponUsed=True, skippedReason=['Coupon Could not be issued'], skippedUsers=True, socialAudienceList=False, socialAdsetInfo=False, aggregationDetail=False).check() except Exception, exp: Assertion.constructAssertion( False, 'Failed with Exception :{}'.format(exp))
'groupName':self.groupName } extraParams = { 'voucher_series': self.voucherSeriesId, 'default_argument' : { "entity_id":-1, "is_loyalty_checkbox_enabled":"0", "voucher_series_id":self.voucherSeriesId, "daily_budget":10000, "create_adset":True, "use_existing_adset":False, "adset_name": 'AutoAdset_{}'.format(int(time.time()*1000)) } } communicationDetailObject = VenenoObject.communicationDetail(cdDetailsBody,extraParams=extraParams) communicationId = self.connObj.addMessageForRecipients(communicationDetailObject) SocialDBAssertion(self.campaigns['CUSTOM'], self.groupVersionid,communicationId, self.numberOfUsers, couponUsed=True, skippedReason=['Coupon Could not be issued'], skippedUsers=True, socialAudienceList=False, socialAdsetInfo=False, aggregationDetail=False).check() except Exception,exp: Assertion.constructAssertion(False,'Failed with Exception :{}'.format(exp)) finally: SocialHelper.couponConfigChange({'fixedExpiryDate':int(time.time() * 1000 + 24 * 60 * 60 * 1000)},self.campaigns['CUSTOM'],self.voucherSeriesId)