コード例 #1
0
 def test_LUCI_RSC_002(self, description, config):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, config)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     # Issue Coupon Code
     couponCode = LuciHelper.issueCouponAndAssertions(self,
                                                      couponSeriesId)[0]
     resendRequest = LuciObject.resendCouponRequest({
         'storeUnitId':
         self.tillId,
         'eventTimeInMillis':
         Utils.getTime(milliSeconds=True),
         'couponCode':
         couponCode,
         'userId':
         self.userId
     })
     couponDetails = self.connObj.resendCoupon(resendRequest).__dict__
     Assertion.constructAssertion(
         couponCode == couponDetails['couponCode'],
         'Resend Coupon Code Actual: {} and Expected: {}'.format(
             couponCode, couponDetails['couponCode']))
     Assertion.constructAssertion(
         couponDetails['ex'] == None,
         'Resend Coupon No exception occurred : {}'.format(
             couponDetails['ex']))
コード例 #2
0
    def test_LUCI_IC_DC_015(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'do_not_resend_existing_voucher': True,
                'allow_multiple_vouchers_per_user': False
            })
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            issuedTo=self.userId,
            dracraysUpload={'userOnly': True})

        luciExp = LuciHelper.issueCouponAndAssertions(self,
                                                      couponSeriesId,
                                                      expectException=True)
        Assertion.constructAssertion(
            luciExp['errorCode'] == constant.COUPON_ALREADY_ISSUED,
            'Luci Exception error code Actual: {} and Expected: {}'.format(
                luciExp['errorCode'], constant.COUPON_ALREADY_ISSUED))
        Assertion.constructAssertion(
            luciExp['errorMsg'] == 'user already has a coupon',
            'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))
コード例 #3
0
 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)
コード例 #4
0
    def test_LUCI_IC_DCP_012(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)

        # Checking Coupon Created Count
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon Code Pumped to Queue')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon Code Pumped to Queue')

        #Update the coupon series from DC -> DCP
        couponConfigObj.update({'client_handling_type': 'DISC_CODE_PIN'})
        LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=couponConfigObj)

        #Checking Queue count and coupons_created count once update DC -> DCP
        time.sleep(2)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount == 0,
                                     'Disc Code Marked as Invalid')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupon codes are cleared from queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self, couponSeriesId, self.constructObj.importType['NONE'])

        # Checking Coupon Count once DCP uploaded +1
        time.sleep(2)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(
            createdCouponCount == 1,
            'Uploaded coupons are recorded in coupons_created')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 1,
            'Coupon Code Pumped to Queue')

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        luciExp = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            {'userId': constant.config['usersInfo'][1]['userId']},
            expectException=True)
        Assertion.constructAssertion(
            luciExp['errorCode'] == constant.COUPONS_EXHAUSTED,
            'Luci Exception error code Actual: {} and Expected: {}'.format(
                luciExp['errorCode'], constant.COUPONS_EXHAUSTED))
        Assertion.constructAssertion(
            luciExp['errorMsg'] == 'coupons exhausted',
            'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))
コード例 #5
0
    def test_LUCI_IC_DC_013(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            issuedTo=self.userId,
            dracraysUpload={'userOnly': True})

        LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})
        LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']},
            couponIssuedCount=2)
コード例 #6
0
    def test_LUCI_SCC_031_sanity(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon Code Pumped to Queue')
        couponConfigObj.update(
            {'description': 'luci testing description changed'})
        couponConfigObj = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigObj)[0]
        couponCode = LuciHelper.issueCouponAndAssertions(self,
                                                         couponSeriesId)[0]
        LuciHelper.redeemCouponAndAssertions(self, [couponSeriesId],
                                             [couponCode])
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)

        #Changing client-handling-type
        couponConfigObj.update({'client_handling_type': 'DISC_CODE_PIN'})
        LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj)
        LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId, 1, 1)
        time.sleep(2)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(
            createdCouponCount == 0,
            'Config changed as DC to DCP and Coupon codes marked as invalid ')
コード例 #7
0
 def test_LUCI_RC_DC_015(self,description, couponConfig, expectedError):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfig)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     LuciHelper.couponPumpAssertion(self, couponSeriesId)
     couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
     #Coupon Redemption
     self.userId = constant.config['usersInfo'][1]['userId']
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, error=expectedError)
コード例 #8
0
 def test_LUCI_RC_DC_016(self,description, couponConfig, expectedError):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfig)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     LuciHelper.couponPumpAssertion(self, couponSeriesId)
     couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
     #Coupon Redemption
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, error=expectedError)
     LuciHelper.redemptionDBAssertion(self, couponSeriesId)
コード例 #9
0
 def test_LUCI_RC_DC_017(self,description, couponConfig, noOfRedeem):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfig)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     LuciHelper.couponPumpAssertion(self, couponSeriesId)
     couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
     #Coupon Redemption
     for _ in range(noOfRedeem):
         LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
     LuciHelper.redemptionDBAssertion(self, couponSeriesId, noOfRedeem)
コード例 #10
0
 def test_LUCI_RC_DC_020(self,description):
     #Save Coupon Config
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq={'redemption_valid_after_days' : 1, 'redemption_valid_from' : None})
     LuciHelper.queuePumpWait(self, couponSeriesId)
     couponCode, couponDetails = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
     changeDate = Utils.getTime(days=-1, minutes=5,milliSeconds=True)
     self.connObj.changeCouponIssuedDate(couponDetails['id'], changeDate)
     #redeem Coupon and Assertion.constructAssertion(on)
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
     LuciHelper.redemptionDBAssertion(self, couponSeriesId)
コード例 #11
0
    def test_LUCI_IMC_DC_016(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'do_not_resend_existing_voucher': False,
                'allow_multiple_vouchers_per_user': True
            })
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
コード例 #12
0
    def test_LUCI_IC_DCP_011(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)

        # Checking Coupon Created Count
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon Code Pumped to Queue')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon Code Pumped to Queue')

        #Update the coupon series from DC -> DCP
        couponConfigObj.update({'client_handling_type': 'DISC_CODE_PIN'})
        LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=couponConfigObj)

        #Checking Queue count and coupons_created count once update DC -> DCP
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount == 0,
                                     'Disc Code Marked as Invalid')

        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupon codes are cleared from queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self, couponSeriesId, self.constructObj.importType['NONE'])

        # Checking Coupon Count once DCP uploaded +1
        time.sleep(2)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(
            createdCouponCount == 1,
            'Uploaded coupons are recorded in coupons_created')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 1,
            'Coupon Code Pumped to Queue')

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'All DCP Coupons are issued')
コード例 #13
0
    def test_LUCI_MU_001(self, description):
        toUserId = randValues.randomInteger(digits=6)
        actualUserId = self.userId
        try:
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                self)
            LuciHelper.queuePumpWait(self, couponSeriesId)
            couponCode = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]

            mergeUserResponse = self.connObj.mergeUsers(
                fromUserId=self.userId,
                toUserId=toUserId,
                mergedbyTillId=self.tillId).__dict__
            Assertion.constructAssertion(
                mergeUserResponse['fromUserId'] == self.userId,
                'Merge From userId is Matched Actual: {} & Expected: {}'.
                format(mergeUserResponse['fromUserId'], self.userId))
            Assertion.constructAssertion(
                mergeUserResponse['toUserId'] == toUserId,
                'Merge to userId is Matched Actual: {} & Expected: {}'.format(
                    mergeUserResponse['toUserId'], toUserId))
            mergeStatus = mergeUserResponse['status'].__dict__
            Assertion.constructAssertion(
                mergeStatus['message'] == 'customer merge was successfull',
                'Merge status Msg Actual: {} & Expected: {}'.format(
                    mergeStatus['message'], 'customer merge was successfull'))
            Assertion.constructAssertion(
                mergeStatus['statusCode'] == constant.MERGE_SUCCESSFUL,
                'Merge status code Actual: {} & Expected: {}'.format(
                    mergeStatus['statusCode'], constant.MERGE_SUCCESSFUL))
            mergeStatus = self.connObj.getMergeStatus(
                fromUserId=self.userId, toUserId=toUserId).__dict__
            Assertion.constructAssertion(
                mergeStatus['message'] == 'customer is already merged',
                'Merge status Msg Actual: {} & Expected: {}'.format(
                    mergeStatus['message'], 'customer is already merged'))
            Assertion.constructAssertion(
                mergeStatus['statusCode'] == constant.MERGED_ALREADY_DONE,
                'Merge status code Actual: {} & Expected: {}'.format(
                    mergeStatus['statusCode'], constant.MERGED_ALREADY_DONE))
            LuciHelper.redeemCouponAndAssertions(
                self, [couponSeriesId], [couponCode],
                error=[
                    625, 'coupon not issued to this user redemption failed'
                ])
            self.userId = toUserId
            LuciHelper.redeemCouponAndAssertions(self, [couponSeriesId],
                                                 [couponCode])
        finally:
            self.userId = actualUserId
コード例 #14
0
    def test_LUCI_IMC_DC_017(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {'max_create': 5})
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        maxCouponSeries = LuciHelper.issueMultipleCoupon(
            self,
            couponSeriesId,
            self.userIds,
            expectResponseException=[True, 'max create for series exceeded'])
        Assertion.constructAssertion(
            len(maxCouponSeries) == 5,
            'Max Create for series Exceeded Exception for Users')
コード例 #15
0
    def test_LUCI_IC_DC_012(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            issuedTo=self.userId,
            dracraysUpload={'userOnly': True})

        couponCode = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})[0]
        Assertion.constructAssertion(not LuciHelper.isNumeric(couponCode),
                                     'Upload & issued Alpha-Numeric coupon')

        self.userId = constant.config['usersInfo'][1]['userId']
        couponCode2 = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})[0]
        Assertion.constructAssertion(
            len(str(couponCode2)) == int(
                self.orgDefaultValue['random_code_length']),
            'Coupon Org Config Length is: {} Actual Coupon Lenght : {}'.format(
                len(str(couponCode2)),
                self.orgDefaultValue['random_code_length']))
        if not self.orgDefaultValue['is_alpha_numeric']:
            Assertion.constructAssertion(
                LuciHelper.isNumeric(couponCode2),
                'Org Config is Numeric Generated Coupon: {}'.format(
                    couponCode2))
        elif self.orgDefaultValue['is_alpha_numeric']:
            Assertion.constructAssertion(
                not LuciHelper.isNumeric(couponCode2),
                'Org Config is AlphaNumeric Generated Coupon: {}'.format(
                    couponCode2))
        self.userId = constant.config['usersInfo'][0]['userId']
コード例 #16
0
 def test_LUCI_RC_DC_012_sanity(self,description):
     #Save Coupon Config
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     LuciHelper.couponPumpAssertion(self, couponSeriesId)
     # issue coupon Code
     couponCode = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
     # CouponConfigAssertion
     LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId, 1, 0)
     # redeem Coupon and Assertion.constructAssertion(on)
     LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
     LuciHelper.redemptionDBAssertion(self, couponSeriesId)
     LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId, 1, 1)
     # GetCoupon Details and Assertion.constructAssertion(on)
     couponDetailsRequest = {'onlyActive': True, 'couponCodeFilter': [couponCode]}
     LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode,couponDetailsRequest)
コード例 #17
0
    def test_LUCI_IMC_DC_011(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)

        # Check the queue size after coupon issued

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(
            couponIssuedList != [],
            'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(
            len(couponIssuedList) == len(self.userIds),
            'Issued Coupons are recorded in coupons_issued')
コード例 #18
0
    def test_LUCI_IC_DC_020_sanity(self, description):
        couponSeriesList = []
        couponConfigObjList = []
        for i in range(4):
            if i % 2:
                mutualCouponSeriesId = '[{}]'.format(couponSeriesList[i - 1])
                couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                    self,
                    couponConfigReq={
                        'mutual_exclusive_series_ids': mutualCouponSeriesId
                    })
                couponConfigObjList.append(couponConfigObj)
                couponSeriesList.append(couponSeriesId)
            else:
                couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                    self)
                couponConfigObjList.append(couponConfigObj)
                couponSeriesList.append(couponSeriesId)

            LuciHelper.queuePumpWait(self, couponSeriesId)
            createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
                couponSeriesId)
            Assertion.constructAssertion(createdCouponCount != 0,
                                         'Coupon Code Pumped to Queue')
            Assertion.constructAssertion(
                self.connObj.getQueueSize(constant.config['orgId'],
                                          couponSeriesId,
                                          constant.config['requestId']) != 0,
                'Coupon Code Pumped to Queue')
            if not i % 2:
                LuciHelper.issueCouponAndAssertions(self, couponSeriesList[i])
            else:
                mutualExclusiveExp = LuciHelper.issueCouponAndAssertions(
                    self, couponSeriesList[i], expectException=True)
                Assertion.constructAssertion(
                    mutualExclusiveExp['errorCode'] ==
                    constant.COUPON_PRESENT_MUTUAL_EXCLUSIVE_SERIES,
                    'Luci Exception error code Actual: {} and Expected: {}'.
                    format(mutualExclusiveExp['errorCode'],
                           constant.COUPON_PRESENT_MUTUAL_EXCLUSIVE_SERIES))
                Assertion.constructAssertion(
                    mutualExclusiveExp['errorMsg'] ==
                    'coupon present in mutually exclusive series id ',
                    'Luci Exception Error Msg Actual : {}'.format(
                        mutualExclusiveExp['errorMsg']))
コード例 #19
0
    def test_LUCI_IMC_DC_015(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'do_not_resend_existing_voucher': True,
                'allow_multiple_vouchers_per_user': False
            })
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        couponAlreadyIssued = LuciHelper.issueMultipleCoupon(
            self,
            couponSeriesId,
            self.userIds,
            expectResponseException=[True, 'user already has a coupon'])
        Assertion.constructAssertion(
            len(couponAlreadyIssued) == len(self.userIds),
            'Coupon Already issued to List of users Sent')
コード例 #20
0
    def test_LUCI_IC_DC_017(self, description):
        actualUserId = self.userId
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        self.userId = constant.config['usersInfo'][1]['userId']
        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        self.userId = actualUserId
コード例 #21
0
 def test_LUCI_BCSKU_002_sanity(self, description):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self)
     prodInfo = LuciObject.productInfo(
         {'productIds': [9926522, 9926523, 15972]})
     couponConfigObj.update({'productInfo': [prodInfo]})
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, couponConfigObj, {'includeProductInfo': True})
     prodInfo = LuciObject.productInfo({
         'productType': 0,
         'productIds': [1243]
     })
     couponConfigObj.update({'productInfo': [prodInfo]})
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, couponConfigObj, {'includeProductInfo': True})
     LuciHelper.queuePumpWait(self, couponSeriesId)
     Assertion.constructAssertion(
         LuciDBHelper.getCouponsCreated_Count(couponSeriesId) != 0,
         'Coupon Code Pumped to Queue')
     configRequest = LuciObject.getCouponConfigRequest(
         {'couponSeriesId': couponSeriesId})
     couponConfigList = self.connObj.getCouponConfiguration(configRequest)
     productInfo = couponConfigList[0].__dict__
     productInfo = productInfo['productInfo']
     productIds = []
     productIds2 = []
     voucherProductDataValuesList = LuciDBHelper.getVoucherProductDataValues(
         couponSeriesId)
     for k in productInfo:
         k = k.__dict__
         Assertion.constructAssertion(
             (k['productType'] == self.constructObj.productType['BRAND'])
             or (k['productType']
                 == self.constructObj.productType['CATEGORY']),
             'PRODUCT TYPE IS MISMATCH')
         productIds += k['productIds']
     for k in voucherProductDataValuesList:
         productIds2.append(k['product_id'])
     Assertion.constructAssertion(
         len(voucherProductDataValuesList) == len(productIds),
         'PRODUCT IDs COUNT IS MISMATCH')
     Assertion.constructAssertion(
         set(productIds) == set(productIds2),
         'PRODUCT IDs ARE MISMATCH IN DB AND THRIFT RESPONSE')
コード例 #22
0
    def test_LUCI_RC_DC_014(self,description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'multiple_use' : True, 'any_user' : True})
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        #issueCode and Doing Assertion.constructAssertion(on)
        couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
        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)
コード例 #23
0
    def test_LUCI_IMC_DC_014(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'do_not_resend_existing_voucher': True,
                'allow_multiple_vouchers_per_user': True,
                'max_vouchers_per_user': 2
            })
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        maxCouponLimitExceed = LuciHelper.issueMultipleCoupon(
            self,
            couponSeriesId,
            self.userIds,
            expectResponseException=[True, 'max coupon per user exceeded'])
        Assertion.constructAssertion(
            len(maxCouponLimitExceed) == len(self.userIds),
            'Max Coupon per user Exceeded with limit 2')
コード例 #24
0
    def test_LUCI_IC_DC_016(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'do_not_resend_existing_voucher': False,
                'allow_multiple_vouchers_per_user': True
            })
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        # upload the coupon code
        couponCode = LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            issuedTo=self.userId,
            dracraysUpload={'userOnly': True})['coupons'][0]
        couponCode1 = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})[0]
        Assertion.constructAssertion(
            couponCode.upper() == couponCode1,
            'Resend coupon  code resend Actual : {} & Expected : {}'.format(
                couponCode, couponCode1))
        couponCode2 = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            couponIssuedCount=2,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})[0]
        Assertion.constructAssertion(
            couponCode1 == couponCode2,
            'Resend coupon  code resend Actual : {} & Expected : {}'.format(
                couponCode1, couponCode2))
コード例 #25
0
 def test_LUCI_RSC_004(self, description, config):
     expectedMsg = 'resend message not enabled for series id : {}'
     try:
         couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
             self, config)
         expectedMsg = expectedMsg.format(couponSeriesId)
         LuciHelper.queuePumpWait(self, couponSeriesId)
         # Issue Coupon Code
         couponCode = LuciHelper.issueCouponAndAssertions(
             self, couponSeriesId)[0]
         resendRequest = LuciObject.resendCouponRequest({
             'storeUnitId':
             self.tillId,
             'eventTimeInMillis':
             Utils.getTime(milliSeconds=True),
             'couponCode':
             couponCode,
             'userId':
             self.userId
         })
         couponDetails = self.connObj.resendCoupon(resendRequest).__dict__
         Assertion.constructAssertion(
             couponCode == couponDetails['couponCode'],
             'Resend Coupon Code Actual: {} and Expected: {}'.format(
                 couponCode, couponDetails['couponCode']))
         Assertion.constructAssertion(
             couponDetails['ex'] == None,
             'Resend Coupon No exception occurred : {}'.format(
                 couponDetails['ex']))
     except Exception, luciExp:
         luciExp = luciExp.__dict__
         Assertion.constructAssertion(
             luciExp['errorCode'] == 653,
             'Resend error Code Actual : {} and Expected: {}'.format(
                 luciExp['errorCode'], 653))
         Assertion.constructAssertion(
             luciExp['errorMsg'] == expectedMsg,
             'Resend error Message Actual : {} and Expected: {}'.format(
                 luciExp['errorMsg'], expectedMsg))
コード例 #26
0
ファイル: test_couponSearch.py プロジェクト: anupsl/pyApps
    def test_LUCI_GCD_011_sanity(self):
        #Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        #Checking Coupon Created Count
        LuciHelper.queuePumpWait(self,couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(couponSeriesId)
        Assertion.constructAssertion(createdCouponCount != 0, 'Coupon Code Pumped to Queue')

        # change the coupon config
        couponConfigObj.update({'do_not_resend_existing_voucher' : True, 'allow_multiple_vouchers_per_user' : True})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        transactionId1 = Utils.getTime(milliSeconds=True);
        time.sleep(1)
        transactionId2 = Utils.getTime(milliSeconds=True);

        #Construct Obj and Issue Coupon Code
        issueCouponObj ={'couponSeriesRequired': True, 'billId' : transactionId1}
        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId,issueCouponObj)[0]

        #Change Issue obj billId and Issue one more coupon
        issueCouponObj = {'couponSeriesRequired': True, 'billId': transactionId2}
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId, issueCouponObj)[0]

        # Added Issue Filter & Search Coupon 1
        issualFilterObj = LuciObject.issualFilters({'transactionId' : [transactionId1]})
        issualFilterObj = {'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId],issualFilterObj ,[couponCode1])

        #Added Issue Filter & Search Coupon 2
        issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId2]})
        issualFilterObj = {'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], issualFilterObj, [couponCode2])

        # Added Issue Filter & Search Coupon 3
        issualFilterObj = LuciObject.issualFilters({'transactionId': [transactionId1 , transactionId2]})
        issualFilterObj = {'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId],issualFilterObj, [couponCode1,couponCode2])
コード例 #27
0
 def test_LUCI_RSC_Invalid_001(self, description, smsTemplate):
     try:
         couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
             self, {'sms_template': smsTemplate})
         LuciHelper.queuePumpWait(self, couponSeriesId)
         # Issue Coupon Code
         couponCode = LuciHelper.issueCouponAndAssertions(
             self, couponSeriesId)[0]
         resendRequest = LuciObject.resendCouponRequest({
             'storeUnitId':
             self.tillId,
             'eventTimeInMillis':
             Utils.getTime(milliSeconds=True),
             'couponCode':
             couponCode,
             'userId':
             self.userId
         })
         couponDetails = self.connObj.resendCoupon(resendRequest).__dict__
         Assertion.constructAssertion(
             couponCode == couponDetails['couponCode'],
             'Resend Coupon Code Actual: {} and Expected: {}'.format(
                 couponCode, couponDetails['couponCode']))
         Assertion.constructAssertion(
             couponDetails['ex'] == None,
             'Resend Coupon No exception occurred : {}'.format(
                 couponDetails['ex']))
     except Exception, luciException:
         luciException = luciException.__dict__
         Assertion.constructAssertion(
             luciException['errorCode'] == 644,
             'Redemption error Code Actual : {} and Expected: {}'.format(
                 luciException['errorCode'], 644))
         Assertion.constructAssertion(
             luciException['errorMsg'] == 'unresolved tags are present',
             'Redemption error Message Actual : {} and Expected: {}'.format(
                 luciException['errorMsg'], 'unresolved tags are present'))
コード例 #28
0
    def test_LUCI_IMC_DC_012(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)
        LuciHelper.queuePumpWait(self, couponSeriesId)
        LuciHelper.couponPumpAssertion(self, couponSeriesId)

        preIssueQC = self.connObj.getQueueSize(constant.config['orgId'],
                                               couponSeriesId,
                                               constant.config['requestId'])

        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            self.userIds,
            noOfCouponsToBeUpload=5,
            dracraysUpload={'userOnly': True})
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds[5:])

        postIssueQC = self.connObj.getQueueSize(constant.config['orgId'],
                                                couponSeriesId,
                                                constant.config['requestId'])

        # Check the queue size after coupon issued
        Assertion.constructAssertion(
            preIssueQC == (postIssueQC + 5),
            'After coupon issued Queue size Mismatch Actual: {} & Expected: {}'
            .format(preIssueQC, (postIssueQC + 5)))
        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(
            couponIssuedList != [],
            'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(
            len(couponIssuedList) == len(self.userIds),
            'Issued Coupons are recorded in coupons_issued Actual: {} and Expected : {}'
            .format(len(couponIssuedList), len(self.userIds)))
コード例 #29
0
 def test_LUCI_IC_DC_011(self, description):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self)
     LuciHelper.queuePumpWait(self, couponSeriesId)
     LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
コード例 #30
0
    def test_LUCI_IC_DC_014(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'do_not_resend_existing_voucher': True,
                'allow_multiple_vouchers_per_user': True,
                'max_vouchers_per_user': 3
            })
        LuciHelper.queuePumpWait(self, couponSeriesId)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupon codes are created for DC')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) != 0,
            'Coupon codes pumped to queue')

        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['USER_ID'],
            issuedTo=self.userId,
            dracraysUpload={'userOnly': True})

        couponCode1 = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})[0]
        couponCode2 = LuciHelper.issueCouponAndAssertions(
            self,
            couponSeriesId,
            issueCouponParamObj={'storeUnitId': constant.config['adminId']})[0]

        Assertion.constructAssertion(
            len(str(couponCode2)) == int(
                self.orgDefaultValue['random_code_length']),
            'Coupon Org Config Length is: {} Actual Coupon Lenght : {}'.format(
                len(str(couponCode2)),
                int(self.orgDefaultValue['random_code_length'])))
        if not self.orgDefaultValue['is_alpha_numeric']:
            Assertion.constructAssertion(
                LuciHelper.isNumeric(couponCode2),
                'Org Config is Numeric Generated Coupon: {}'.format(
                    couponCode2))
        elif self.orgDefaultValue['is_alpha_numeric']:
            Assertion.constructAssertion(
                not LuciHelper.isNumeric(couponCode2),
                'Org Config is AlphaNumeric Generated Coupon: {}'.format(
                    couponCode2))
        luciExp = LuciHelper.issueCouponAndAssertions(self,
                                                      couponSeriesId,
                                                      expectException=True)
        Assertion.constructAssertion(
            luciExp['errorCode'] ==
            constant.MAX_COUPON_ISSUAL_PER_USER_EXCEEDED,
            'Luci Exception error code Actual: {} and Expected: {}'.format(
                luciExp['errorCode'],
                constant.MAX_COUPON_ISSUAL_PER_USER_EXCEEDED))
        Assertion.constructAssertion(
            luciExp['errorMsg'] == 'max coupon per user exceeded',
            'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))