Beispiel #1
0
    def test_downloadCoupon_Generic(self, description):
        try:
            couponCode = LuciHelper.generateCouponCode()
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                self, {
                    'client_handling_type': 'GENERIC',
                    'genericCode': couponCode
                })

            couponCode1 = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]
            self.userId = constant.config['usersInfo'][1]['userId']
            couponCode2 = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]
            DracarysHelper.downloadCouponsRequestAndAssertion(
                self, couponSeriesId,
                self.DracarysObj.DownloadReportType['ISSUED'],
                [couponCode1, couponCode2])
            LuciHelper.redeemCouponAndAssertions(self, couponSeriesId,
                                                 couponCode)
            DracarysHelper.downloadCouponsRequestAndAssertion(
                self, couponSeriesId,
                self.DracarysObj.DownloadReportType['REDEEMED'], [couponCode])
        finally:
            self.userId = constant.config['usersInfo'][0]['userId']
 def test_LUCI_RC_DCP_018_sanity(self, description):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self,
         couponConfigReq={
             'client_handling_type': 'DISC_CODE_PIN',
             'multiple_use': True,
             'same_user_multiple_redeem': True,
             'do_not_resend_existing_voucher': True,
             'allow_multiple_vouchers_per_user': True,
             'max_redemptions_in_series_per_user': 2
         })
     couponCode = LuciHelper.uploadCouponAndAssertions(
         self, couponSeriesId,
         self.constructObj.importType['NONE'])['coupons'][0]
     LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
     couponDetails = LuciHelper.redeemCouponAndAssertions(self,
                                                          couponSeriesId,
                                                          couponCode,
                                                          isRedeem=False)
     CouponRedemptionCount = couponDetails['redemptionCountDetails'][
         0].__dict__
     Assertion.constructAssertion(
         CouponRedemptionCount['redemptionCount'] == 1,
         'Coupon Redemption Count Actual: {} and Expected: {}'.format(
             CouponRedemptionCount['redemptionCount'], 1))
     Assertion.constructAssertion(
         CouponRedemptionCount['userId'] == self.userId,
         'Redemption userId Actual: {} and Expected: {}'.format(
             CouponRedemptionCount['userId'], self.userId))
     LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)
    def test_LUCI_RC_DCP_011_sanity_smoke(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self,
            couponConfigReq={
                'client_handling_type': 'DISC_CODE_PIN',
                'max_redeem': 10
            })

        #upload the coupon code
        couponCode = LuciHelper.uploadCouponAndAssertions(
            self, couponSeriesId,
            self.constructObj.importType['NONE'])['coupons'][0]
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 0, 0)

        #Check in issued table
        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(
            couponIssuedList == [], 'Issued Coupon recorded in coupons_issued')

        #Checking Queue count and coupons_created count once update DC -> DCP
        couponsCreatedList = LuciDBHelper.getCouponsCreated(couponSeriesId)
        Assertion.constructAssertion(
            couponsCreatedList != [],
            'Uploaded Coupons Added in Coupons_created table')
        Assertion.constructAssertion(
            len(couponsCreatedList) == 1,
            'Uploaded Coupon recorded in DB, Actual: {} and Expected : {}'.
            format(len(couponsCreatedList), 1))
        Assertion.constructAssertion(
            couponsCreatedList[0]['couponCode'] == couponCode,
            'Uploaded Coupon Code, Actual : {} and Expected : {}'.format(
                couponsCreatedList[0]['couponCode'], couponCode))

        #issueCode and Doing Assertion.constructAssertion(on)
        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0)
        # CouponDetails Request
        LuciHelper.getCouponDetailsAndAssertion(self,
                                                couponSeriesId,
                                                couponCode,
                                                couponDetailsRequest={
                                                    'onlyActive':
                                                    True,
                                                    'couponCodeFilter':
                                                    [couponCode]
                                                })
        #Coupon Redemption
        LuciHelper.redeemCouponAndAssertions(self,
                                             couponSeriesId,
                                             couponCode,
                                             isMaxRedeemSet=True)

        LuciHelper.redemptionDBAssertion(self, couponSeriesId)
        # Get Coupon Configuration
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)
 def test_LUCI_RC_DCP_016(self, description, couponConfig, noOfRedeem):
     couponConfig.update({'client_handling_type': 'DISC_CODE_PIN'})
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, couponConfigReq=couponConfig)
     couponCode = LuciHelper.uploadCouponAndAssertions(
         self, couponSeriesId,
         self.constructObj.importType['NONE'])['coupons'][0]
     LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
     #Coupon Redemption
     for _ in range(noOfRedeem):
         LuciHelper.redeemCouponAndAssertions(self, couponSeriesId,
                                              couponCode)
     LuciHelper.redemptionDBAssertion(self, couponSeriesId, noOfRedeem)
 def test_LUCI_RC_DCP_014(self, description, couponConfig, expectedError):
     couponConfig.update({'client_handling_type': 'DISC_CODE_PIN'})
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, couponConfigReq=couponConfig)
     couponCode = LuciHelper.uploadCouponAndAssertions(
         self, couponSeriesId,
         self.constructObj.importType['NONE'])['coupons'][0]
     LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
     #Coupon Redemption
     self.userId = constant.config['usersInfo'][1]['userId']
     LuciHelper.redeemCouponAndAssertions(self,
                                          couponSeriesId,
                                          couponCode,
                                          error=expectedError)
    def test_LUCI_RC_DCP_013(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self,
            couponConfigReq={
                'client_handling_type': 'DISC_CODE_PIN',
                'multiple_use': True,
                'any_user': True
            })
        couponCode = LuciHelper.uploadCouponAndAssertions(
            self, couponSeriesId,
            self.constructObj.importType['NONE'])['coupons'][0]

        #issueCode and Doing Assertion.constructAssertion(on)
        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0)
        LuciHelper.getCouponDetailsAndAssertion(self,
                                                couponSeriesId,
                                                couponCode,
                                                couponDetailsRequest={
                                                    'onlyActive':
                                                    True,
                                                    'couponCodeFilter':
                                                    [couponCode]
                                                })
        #Coupon Redemption
        redeemedIds = [self.userId]
        LuciHelper.redeemCouponAndAssertions(
            self,
            couponSeriesId,
            couponCode,
            couponIssuedTo=[constant.config['usersInfo'][0]['userId']])
        self.userId = constant.config['usersInfo'][1]['userId']
        redeemedIds.append(self.userId)
        LuciHelper.redeemCouponAndAssertions(
            self,
            couponSeriesId,
            couponCode,
            couponIssuedTo=[constant.config['usersInfo'][0]['userId']])
        self.userId = constant.config['usersInfo'][2]['userId']
        redeemedIds.append(self.userId)
        LuciHelper.redeemCouponAndAssertions(
            self,
            couponSeriesId,
            couponCode,
            couponIssuedTo=[constant.config['usersInfo'][0]['userId']])
        LuciHelper.redemptionDBAssertion(self,
                                         couponSeriesId,
                                         numRedeemed=3,
                                         redeemedBy=redeemedIds)
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 3)
Beispiel #7
0
 def test_LUCI_CF_009(self, description, couponConfig, expected):
     try:
         couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
             self, couponConfig)
         LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
     except Exception, luciExp:
         luciExp = luciExp.__dict__
         Assertion.constructAssertion(
             luciExp['errorCode'] == expected[0],
             'Luci Exception error code Actual: {} and Expected: {}'.format(
                 luciExp['errorCode'], expected[0]))
         Assertion.constructAssertion(
             luciExp['errorMsg'] == expected[1],
             'Luci Exception Error Msg Actual : {}'.format(
                 luciExp['errorMsg']))
 def test_LUCI_RC_DCP_019(self,description):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     LuciHelper.couponPumpAssertion(self, couponSeriesId)
     couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, isRedeem=False)
     LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 0)