Exemple #1
0
 def test_updateCampaign_WithDifferntCampaignName_NegativeCases(
         self, description, campaignName, statusCode, errorCode,
         errorMessage):
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         {'name': campaignName}, campaignType=['LIVE', 'ORG'])
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(updateResponse, createResponse,
                                    statusCode, errorCode, errorMessage)
Exemple #2
0
 def test_updateCampaign_WrongCampaignId(self, description, campaignId):
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         {'name': 'Wrong_CampaignId' + str(int(time.time()))},
         campaignId=campaignId)
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(
         updateResponse, createResponse, 400, 100,
         'Invalid request : must be greater than or equal to 1')
Exemple #3
0
 def test_updateCampaign_WithExistingCampaignName(self):
     existingCampaignId, existingCampaignPayload = dbCallsCampaign.getLapsedCamapign(
         constant.config['orgId'], 'ORG')
     existingCampaignName = existingCampaignPayload.get('name')
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         {'name': existingCampaignName}, campaignType=['LIVE', 'ORG'])
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(
         updateResponse, createResponse, 400, 1003,
         'Campaign Name Exception : Campaign Name already exists')
Exemple #4
0
 def test_updateCampaign_invalidObjectiveId(self):
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         {
             'name': 'InvalidObjectiveId' + str(int(time.time())),
             'objectiveId': 9999
         },
         campaignType=['LIVE', 'ORG'])
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(
         updateResponse, createResponse, 400, 1005,
         'Campaign Objective Exception : Invalid Campaign Objective Id')
Exemple #5
0
 def test_strictOrgUpdate(self):
     strictOrg = constant.config['strict_org_id']
     previousOrgId = construct.updateOrgId(strictOrg)
     try:
         updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
             {
                 'name':
                 'strict_ORG_ShouldNotBeUpdated' + str(int(time.time()))
             },
             campaignId=int(constant.config['strict_campaign_id']))
         Logger.log(
             'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
             .format(updateResponse, createResponse, updatePayload,
                     createPayload))
         campaigns.assertUpdateCampaign(
             updateResponse, createResponse, 400, 1010,
             'CAMPAIGN_UPDATE_EXCEPTION : Campaign Cannot be updated as it has already approved messages'
         )
     except AssertionError, exp:
         Logger.log('Assertion Failed as :', exp)
Exemple #6
0
 def test_updateCampaign_Live(self, description, campaignType,
                              payloadToUpload, statusCode, errorCode,
                              errorMessage):
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         payloadToUpload, campaignType=campaignType)
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(updateResponse, createResponse,
                                    statusCode, errorCode, errorMessage)
     if statusCode == 200:
         createPayload.update(updatePayload)
         Logger.log(
             'Payload Constructed from updatepayload and create payload : ',
             createPayload)
         campaigns.assertUpdateCampaignDBCall(
             createPayload,
             updateResponse.get('json').get('entity').get('campaignId'))
     else:
         Logger.log('No DB Validation as statusCode :', statusCode)
Exemple #7
0
 def test_updateCampaign_VariationInStartEndDate(self, description,
                                                 startDate, endDate,
                                                 statusCode, errorCode,
                                                 errorMessage):
     payloadToUpdate = {
         'name': 'StartDate_EndDate_Variation' + str(int(time.time())),
         'startDate': startDate,
         'endDate': endDate
     }
     if startDate == '':
         payloadToUpdate.pop('startDate')
     elif endDate == '':
         payloadToUpdate.pop('endDate')
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         payloadToUpdate, campaignType=['UPCOMING', 'ORG'])
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(updateResponse, createResponse,
                                    statusCode, errorCode, errorMessage)
Exemple #8
0
 def test_getCampaign_updateCampaign(self, description, payloadToUpload,
                                     campaignType):
     updateResponse, createResponse, updatePayload, createPayload = campaigns.updateCampaign(
         payloadToUpload, campaignType=campaignType)
     Logger.log(
         'updateResponse :{} , createResponse :{} , updatePayload :{} ,createPayload :{}'
         .format(updateResponse, createResponse, updatePayload,
                 createPayload))
     campaigns.assertUpdateCampaign(updateResponse, createResponse, 200)
     if updateResponse.get('statusCode') == 200:
         createPayload.update(updatePayload)
         getCampaignResponse = campaigns.getCampaignById(
             campaignId=updateResponse.get('json').get('entity').get(
                 'campaignId'))
         campaigns.assertGetCampaign(getCampaignResponse, 200)
         campaigns.assertGetCampaignDBCall(
             getCampaignResponse,
             updateResponse.get('json').get('entity').get('campaignId'))
     else:
         Logger.log(
             'Status Code for updateCampaign is not 200 so no call to Get Campaign for this case'
         )