def test_irisV2_getPoc_WrongAuth(self): previousUserName = None try: previousUserName = IrisHelper.updateUserName('WrongName') response = Poc.getPoc() Poc.assertResponse(response, 401, 999999, 'Unauthorized') finally: if previousUserName is not None: IrisHelper.updateUserName(previousUserName)
def test_productCategory_wrongUserName(self, apiCategory): try: actualUserName = IrisHelper.updateUserName('ztyv') actualResult = ProductCategory.getLevelsForDimension(apiCategory) ProductCategory.assertResponse(actualResult, 401, expectedErrorCode=999999, expectedErrorMessage='Unauthorized') finally: IrisHelper.updateUserName(actualUserName)
def test_irisV2_getLoyaltyProgram_WrongAuth(self): previousUserName = None try: previousUserName = IrisHelper.updateUserName('WrongName') response = LoyaltyProgram.getLoyaltyProgram() LoyaltyProgram.assertResponse(response, 401, 999999, 'Unauthorized') finally: if previousUserName is not None: IrisHelper.updateUserName(previousUserName)
def test_irisV2_editCampaign_WrongAuth(self, description, campaignType, testControlType, editInfo, statusCode, errorCode, errorDescription): campaignInfo = CreateCampaign.create(campaignType, testControlType, updateNode=True) previousUserName = None try: previousUserName = IrisHelper.updateUserName('WrongName') editInfo = CreateCampaign.edit(campaignInfo, editInfo) Assertion.constructAssertion( editInfo['RESPONSE']['statusCode'] == statusCode, 'Actual Status Code :{} and Expected : {}'.format( editInfo['RESPONSE']['statusCode'], statusCode)) finally: if previousUserName is not None: IrisHelper.updateUserName(previousUserName)
def test_irisv2_editMessage_with_wrongAuth(self, campaignType, testControlType, listType, channel, messageInfo, statusCode, errorCode, errorDescription): messageDetails = CreateMessage.create(campaignType, testControlType, listType, channel, messageInfo, updateNode=True, lockNode=True) message_calls().waitForJobDetailsStatusToClose(messageDetails['RESPONSE']['json']['entity']['id'], 'VARIANT_CREATION') CreateMessage.assertResponse(messageDetails['RESPONSE'], 200) previousUserName = None try: previousUserName = IrisHelper.updateUserName('WrongName') editInfo = CreateMessage.edit(constant.config['node'][campaignType][testControlType]['CAMPAIGN']['ID'], messageDetails['RESPONSE']['json']['entity']['id'], messageDetails['PAYLOAD']) CreateMessage.assertResponse(editInfo['RESPONSE'], 401, expectedErrorCode=[errorCode], expectedErrorMessage=errorDescription) finally: if previousUserName is not None: IrisHelper.updateUserName(previousUserName)
def test_getMessage_negative_validationMessagewrongAuth(self): previousUser = IrisHelper.updateUserName('XXXXXX') try: response = GetMessage.getMessageById( self.campaignId, self.messageDetails['RESPONSE']['json']['entity']['id'], queryParam=[('include', 'true')]) GetMessage.assertResponse(response, 401, 999999, 'Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception Occured :{}'.format(exp))
def test_testAndPreview_negative_validationCases_wrongAuth(self): previousAuth = IrisHelper.updateUserName('First') try: payload = copy.deepcopy(self.testAndControlPayload['SMS']) testPreviewResponse, testPreviewPayload = TestPreview.create( 'LIVE', 'ORG', 'MOBILE', 0, payload=payload) TestPreview.assertResponse(testPreviewResponse, 401, 999999, 'Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception Occured :{}'.format(exp))
def test_irisV2_getCampaign_ID_wrongAuth(self): previousUserName = None try: payload = copy.deepcopy(constant.payload['createcampaignv2']) payload.update({'name': 'test_irisV2_getCampaign_ID_wrongAuth_{}'.format(int(time.time()))}) payload["testControl"].pop("testPercentage") campaignInfo = CreateCampaign.create('LIVE', 'ORG', payload=payload, updateNode=True, lockNode=True) previousUserName = IrisHelper.updateUserName('WrongName') getCampaignInfoResponse = GetCampaign.getById(campaignInfo['ID']) GetCampaign.assertResponse(getCampaignInfoResponse, 401, 999999, 'Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception :{}'.format(exp))
def test_approveMessage_negative_validationMessage_wrongAuth(self): previousUser = IrisHelper.updateUserName('XXXX') try: responseAuthorize = AuthorizeMessage.approveWithCampaignAndMessageId( self.campaignInfo['ID'], self.messageDetails['RESPONSE']['json']['entity']['id']) AuthorizeMessage.assertResponse( responseAuthorize, 401, expectedErrorCode=999999, expectedErrorMessage='Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception Occured :{}'.format(exp))
def test_approveMessage_negative_validationMessage_wrongAuth(self): previousUser = IrisHelper.updateUserName('XXXX') try: responseAuthorize = AuthorizeMessage.approveWithCampaignAndMessageId( self.campaignInfo['ID'], self.messageDetails['RESPONSE']['json']['entity']['id']) AuthorizeMessage.assertResponse( responseAuthorize, 401, expectedErrorCode=999999, expectedErrorMessage='Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception Occured :{}'.format(exp)) finally: IrisHelper.updateUserName(previousUser) def test_approveMessage_negative_validationMessage_wrongOrgId(self): previousOrg = IrisHelper.updateOrgId(-1) Logger.log(constant.config['orgId']) try: responseAuthorize = AuthorizeMessage.approveWithCampaignAndMessageId( self.campaignInfo['ID'], self.messageDetails['RESPONSE']['json']['entity']['id']) AuthorizeMessage.assertResponse( responseAuthorize, 401, expectedErrorCode=999999, expectedErrorMessage='Invalid org id') except Exception, exp: Assertion.constructAssertion(False,
def test_irisV2_getCampaign_ID_wrongAuth(self): previousUserName = None try: payload = copy.deepcopy(constant.payload['createcampaignv2']) payload.update({'name': 'test_irisV2_getCampaign_ID_wrongAuth_{}'.format(int(time.time()))}) payload["testControl"].pop("testPercentage") campaignInfo = CreateCampaign.create('LIVE', 'ORG', payload=payload, updateNode=True, lockNode=True) previousUserName = IrisHelper.updateUserName('WrongName') getCampaignInfoResponse = GetCampaign.getById(campaignInfo['ID']) GetCampaign.assertResponse(getCampaignInfoResponse, 401, 999999, 'Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception :{}'.format(exp)) finally: if previousUserName is not None: IrisHelper.updateUserName(previousUserName) @pytest.mark.parametrize('campaignType,testControlType', [ ('LIVE', 'ORG') ]) def test_irisV2_getCampaign_byId_for_Objective_and_GA(self, campaignType, testControlType): payload = copy.deepcopy(constant.payload['createcampaignv2']) payload.update({ "name": "Automation_IRISV2_{}".format(int(time.time() * 1000)), "objective": { "objectiveName": "Boost_Sales" },
'Invalid request : Channel in message content is required.' ]) def test_testAndPreview_negative_validationCases_wrongAuth(self): previousAuth = IrisHelper.updateUserName('First') try: payload = copy.deepcopy(self.testAndControlPayload['SMS']) testPreviewResponse, testPreviewPayload = TestPreview.create( 'LIVE', 'ORG', 'MOBILE', 0, payload=payload) TestPreview.assertResponse(testPreviewResponse, 401, 999999, 'Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception Occured :{}'.format(exp)) finally: IrisHelper.updateUserName(previousAuth) def test_testAndPreview_negative_validationCases_emptyAuth(self): previousAuth = IrisHelper.updateUserName('') previousPass = IrisHelper.updatepassword('') try: payload = copy.deepcopy(self.testAndControlPayload['SMS']) testPreviewResponse, testPreviewPayload = TestPreview.create( 'LIVE', 'ORG', 'MOBILE', 0, payload=payload) TestPreview.assertResponse(testPreviewResponse, 401, 999999, 'Unauthorized') except Exception, exp: Assertion.constructAssertion(False, 'Exception Occured :{}'.format(exp)) finally: IrisHelper.updateUserName(previousAuth)