Ejemplo n.º 1
0
 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))
Ejemplo n.º 2
0
 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))
Ejemplo n.º 3
0
 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))
Ejemplo n.º 4
0
 def test_createCoupon_popMandatoryFields(self, description, fieldToPop,
                                          statusCode, errorCode,
                                          errorMessage):
     response, payload, campaignId = coupons.createCoupons(fieldToPop,
                                                           process='pop')
     coupons.assertCreateCoupon(response, statusCode, errorCode,
                                errorMessage)
Ejemplo n.º 5
0
 def test_createCoupon_NegativeCases_Variation(self, description,
                                               payloadData, statusCode,
                                               errorCode, errorMessage):
     response, payload, campaignId = coupons.createCoupons(
         payloadData=payloadData, campaignType=['LIVE', 'ORG'])
     coupons.assertCreateCoupon(response, statusCode, errorCode,
                                errorMessage)
Ejemplo n.º 6
0
 def test_createCoupon_SameCampaignSameName(self, description, payloadData):
     response, payload, campaignId = coupons.createCoupons(
         payloadData=payloadData)
     coupons.assertCreateCoupon(response, 200)
     secondResponse, secondPayload, campaignId = coupons.createCoupons(
         payloadData=payloadData, campaignId=campaignId)
     coupons.assertCreateCoupon(
         secondResponse, 400, 4005,
         'Coupon Exists Exception :  Coupon Already Exists for this Campaign '
     )
Ejemplo n.º 7
0
 def test_createCoupon_MultipleCouponInSameCampaign(self, description,
                                                    payloadData):
     response, payload, campaignId = coupons.createCoupons(
         payloadData=payloadData)
     coupons.assertCreateCoupon(response, 200)
     failedResponse, failedCasepayload, campaignId = coupons.createCoupons(
         payloadData=payloadData, campaignId=campaignId)
     coupons.assertCreateCoupon(
         failedResponse, 400, 4005,
         'Coupon Exists Exception :  Coupon Already Exists for this Campaign '
     )
     coupons.assertCreateCouponDbCalls(response, payload, campaignId)
Ejemplo n.º 8
0
 def test_createCoupon_tillIds_differentIssuableAndReedemableTills(
         self, description, payloadData):
     tillIdList = map(
         int,
         dbCallsCoupons.getEntityIdWithType()['TILL'].split(','))
     payloadData.update({
         'redeemableTillIds': [tillIdList[1]],
         'issuableTillIds': [tillIdList[0]]
     })
     Logger.log('PayloadDate Including till list :', payloadData)
     response, payload, campaignId = coupons.createCoupons(
         payloadData=payloadData)
     coupons.assertCreateCoupon(response, 200)
Ejemplo n.º 9
0
 def test_createCoupon_campaignIdNotInPassedOrg(self):
     campaignResponse, campaignPayload = campaigns.createCampaign({
         'name':
         'IRIS_' + str(int(time.time())),
         'goalId':
         constant.irisGenericValues['goalId'],
         'objectiveId':
         constant.irisGenericValues['objectiveId']
     })
     previousOrgId = construct.updateOrgId(0)
     try:
         response, payload, campaignId = coupons.createCoupons(
             campaignId=campaignResponse['json']['entity']['campaignId'])
         coupons.assertCreateCoupon(
             response, 400, 1007,
             'Campaign Id Exception : Invalid Campaign Id Passed {}'.format(
                 campaignId))
     except AssertionError, exp:
         Assertion.constructAssertion(False, exp)
Ejemplo n.º 10
0
 def test_createCoupon_TillIds(self, description, payloadData):
     response, payload, campaignId = coupons.createCoupons(
         payloadData=payloadData)
     coupons.assertCreateCoupon(response, 200)
     coupons.assertCreateCouponDbCalls(response, payload, campaignId)
Ejemplo n.º 11
0
 def test_createCoupon_wrongCampaignId(self, description, payloadData):
     response, payload, campaignId = coupons.createCoupons(
         payloadData=payloadData, campaignId=0)
     coupons.assertCreateCoupon(
         response, 400, 100,
         'Invalid request : Campaign id should be a positive value.')