def test_createCoupon_campaignConceptType_CouponOrgType( self, description, payloadData): parentChild = dbCallsCoupons.getParentChildRelationOnEntities() Logger.log('Parent and Child Map :', parentChild) try: if construct.updateAuthenticate('concept') == True: conceptId = str(auth.authLogin()['json']['user'] ['aryaUserRoles']['CONCEPT'][0]['entityId']) createCampaignresponse, createCampaignPayload = campaigns.createCampaign( { 'entityId': conceptId, 'name': 'IRIS_' + str(int(time.time())), 'goalId': constant.irisGenericValues['goalId'], 'objectiveId': constant.irisGenericValues['objectiveId'] }) if construct.updateAuthenticate() == True: Logger.log('PayloadDate Including till list :', payloadData) response, payload, campaignId = coupons.createCoupons( payloadData=payloadData, campaignId=createCampaignresponse['json']['entity'] ['campaignId']) coupons.assertCreateCoupon( response, 400, 4004, 'Coupon Request Body Violation Exception : Creation of Coupon for this campaign is not allowed for this user' ) else: Assertion.constructAssertion( False, 'Marking as Failed as Authenticate was not Properly Updated' ) except AssertionError, exp: Assertion.constructAssertion(False, 'Case Failed Due to :{}'.format(exp))
def test_createCoupon_tillsFromSameConcept_userConceptLevel( self, description, payloadData): parentChild = dbCallsCoupons.getParentChildRelationOnEntities() Logger.log('Parent and Child Map :', parentChild) try: if construct.updateAuthenticate('concept') == True: conceptId = str(auth.authLogin()['json']['user'] ['aryaUserRoles']['CONCEPT'][0]['entityId']) tillId = coupons.getTillFromParentEntity( parentChild, conceptId) payloadData.update({ 'issuableTillIds': [tillId], 'redeemableTillIds': [tillId] }) Logger.log('PayloadDate Including till list :', payloadData) response, payload, campaignId = coupons.createCoupons( payloadData=payloadData) coupons.assertCreateCoupon(response, 200) coupons.assertCreateCouponDbCalls(response, payload, campaignId) else: Assertion.constructAssertion( False, 'Marking as Failed as Authenticate was not Properly Updated' ) except AssertionError, exp: Assertion.constructAssertion(False, 'Case Failed Due to :{}'.format(exp))
def test_createCoupon_passingStoreIdInTill_userConceptLevel( self, description, payloadData): parentChild = dbCallsCoupons.getParentChildRelationOnEntities() Logger.log('Parent and Child Map :', parentChild) try: if construct.updateAuthenticate('concept') == True: conceptId = str(auth.authLogin()['json']['user'] ['aryaUserRoles']['CONCEPT'][0]['entityId']) storeId = parentChild[conceptId].split(',')[0] payloadData.update({ 'issuableTillIds': [storeId], 'redeemableTillIds': [storeId] }) Logger.log('PayloadDate Including till list :', payloadData) response, payload, campaignId = coupons.createCoupons( payloadData=payloadData) coupons.assertCreateCoupon( response, 400, 4004, 'Coupon Request Body Violation Exception : Invalid set of issuable till ids.' ) else: Assertion.constructAssertion( False, 'Marking as Failed as Authenticate was not Properly Updated' ) except AssertionError, exp: Assertion.constructAssertion(False, 'Case Failed Due to :{}'.format(exp))
Logger.log('PayloadDate Including till list :', payloadData) response, payload, campaignId = coupons.createCoupons( payloadData=payloadData) coupons.assertCreateCoupon(response, 200) coupons.assertCreateCouponDbCalls(response, payload, campaignId) else: Assertion.constructAssertion( False, 'Marking as Failed as Authenticate was not Properly Updated' ) except AssertionError, exp: Assertion.constructAssertion(False, 'Case Failed Due to :{}'.format(exp)) finally: construct.updateAuthenticate() Logger.log('Finally Admin User :{} Set to Authenticate'.format( constant.config['intouchUsername'])) @pytest.mark.parametrize('description,payloadData', [ ('Multiple Coupons in Same Campaign', { 'couponLimit': { 'limit': 0, 'type': 'UNLIMITED' }, 'discountOn': 'BILL', 'discountType': 'ABS', 'discountValue': 10 }), ]) def test_createCoupon_wrongIssuableTillId_userConceptLevel(