Пример #1
0
    def test_LUCI_IMC_DCP_011_sanity_smoke(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})
        LuciHelper.couponPumpAssertion(self, couponSeriesId, False)
        noOfCouponUpload = 10

        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=noOfCouponUpload)

        time.sleep(2)
        LuciHelper.couponPumpAssertion(
            self,
            couponSeriesId,
            isDiscCode=False,
            DiscCodePinCouponUploaded=noOfCouponUpload)

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

        # Check the queue size after coupon issued
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupon Queue count deducted with No. of Issued Coupons')

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(
            couponIssuedList != [],
            'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(
            len(couponIssuedList) == noOfCouponUpload,
            'Issued Coupons are recorded in coupons_issued')
Пример #2
0
    def test_LUCI_IMC_DCP_014(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'client_handling_type': 'DISC_CODE_PIN',
                'do_not_resend_existing_voucher': True,
                'allow_multiple_vouchers_per_user': True,
                'max_vouchers_per_user': 2
            })
        LuciHelper.couponPumpAssertion(self, couponSeriesId, isDiscCode=False)
        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=20)

        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')
Пример #3
0
 def test_LUCI_IMC_DCP_019(self, description, invalidInput, expected):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, {'client_handling_type': 'DISC_CODE_PIN'})
     # upload the coupon code
     LuciHelper.uploadCouponAndAssertions(
         self, couponSeriesId, self.constructObj.importType['NONE'])
     if invalidInput == None:
         invalidInput = {
             'userIds': [
                 constant.config['usersInfo'][0]['userId'],
                 constant.config['usersInfo'][0]['userId']
             ]
         }
         expected[1] = expected[1].format(
             constant.config['usersInfo'][0]['userId'])
     try:
         LuciHelper.issueMultipleCoupon(self,
                                        couponSeriesId,
                                        self.userIds,
                                        issueCouponParamObj=invalidInput)
     except Exception, luciExp:
         Logger.log('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']))
Пример #4
0
    def test_LUCI_IMC_GC_02(self, description, couponConfig, expectedErrorMsg, sentHistoryCount):
        couponCode = LuciHelper.generateCouponCode()
        couponConfig.update({'client_handling_type' : 'GENERIC', 'genericCode' : couponCode})
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq=couponConfig)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)


        exceptionList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds, expectResponseException=[True, expectedErrorMsg])
        Assertion.constructAssertion(len(exceptionList) == len(self.userIds), 'Requested issual {}'.format(expectedErrorMsg))
Пример #5
0
    def test_LUCI_IMC_GC_01(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq={'client_handling_type' : 'GENERIC', 'genericCode' : couponCode})

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

        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')
Пример #6
0
    def test_LUCI_IMC_GC_09(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type' : 'GENERIC', 'genericCode' : couponCode, 'do_not_resend_existing_voucher' : False, 'allow_multiple_vouchers_per_user' : False , 'valid_days_from_create' : 1})

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

        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')
    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)
Пример #8
0
    def test_LUCI_IMC_GC_08(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type' : 'GENERIC', 'genericCode' : couponCode, 'do_not_resend_existing_voucher' : False, 'allow_multiple_vouchers_per_user' : False , 'valid_days_from_create' : 1})

        couponDetailsList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        for couponDetails in couponDetailsList:
            couponDetails = couponDetails.__dict__
            self.connObj.changeCouponIssuedDate(couponDetails['id'], Utils.getTime(days=-2, minutes=5,milliSeconds=True))

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

        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')
Пример #9
0
    def test_LUCI_IMC_GC_05(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type' : 'GENERIC', 'genericCode' : couponCode, 'do_not_resend_existing_voucher' : True, 'allow_multiple_vouchers_per_user' : True , 'valid_days_from_create' : 1})

        couponDetailsList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        for couponDetails in couponDetailsList:
            couponDetails = couponDetails.__dict__
            self.connObj.changeCouponIssuedDate(couponDetails['id'], Utils.getTime(days=-2, minutes=5,milliSeconds=True))

        LuciHelper.uploadCouponAndAssertions(self, couponSeriesId, self.constructObj.importType['USER_ID'], self.userIds, noOfCouponsToBeUpload=10, dracraysUpload={'userOnly': True})
        couponAlreadyIssued = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds, expectResponseException=[True,'user already has a valid generic coupon'])
        Assertion.constructAssertion(len(couponAlreadyIssued) == len(self.userIds), 'Coupon Already issued to List of users Sent')

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(couponIssuedList != [], 'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(len(couponIssuedList) == len(self.userIds)*2, 'Issued Coupons are recorded in coupons_issued')
    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')
    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')
Пример #12
0
    def test_LUCI_IMC_DCP_016(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'client_handling_type': 'DISC_CODE_PIN',
                'do_not_resend_existing_voucher': False,
                'allow_multiple_vouchers_per_user': True
            })
        LuciHelper.couponPumpAssertion(self, couponSeriesId, isDiscCode=False)

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

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
Пример #13
0
 def test_LUCI_CF_010(self, description, couponConfig, expected):
     try:
         couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
             self, couponConfig)
         userList = []
         for tmpDict in constant.config['usersInfo']:
             userList.append(tmpDict['userId'])
         LuciHelper.issueMultipleCoupon(self, couponSeriesId, userList)
     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_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')
Пример #15
0
    def test_downloadCoupon_002(self):
        self.couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)[1]
        tmpListOfUsers = []
        for _ in range(2500):
            tmpListOfUsers.append(randValues.randomInteger(7))
        listOfUsers = list(set(tmpListOfUsers))
        limit = 1000
        for i in range(0, len(listOfUsers)):
            if limit > len(listOfUsers):
                limit = len(listOfUsers)
            Logger.log(listOfUsers[i:limit])
            LuciHelper.issueMultipleCoupon(
                self,
                self.couponSeriesId,
                listOfUsers[i:limit],
                expectResponseException=[True, 'coupons exhausted'])
            i = limit
            limit = limit + 1000

        requestObj = DracarysObject.DownloadCouponsRequest(
            {'couponSeriesId': self.couponSeriesId})
        jobRes = self.DracraysConnObj.downloadCouponsReport(
            requestObj).__dict__
        requestsStatusObj = DracarysObject.GetDownloadStatus({
            'couponSeriesId':
            self.couponSeriesId,
            'jobId':
            jobRes['jobId']
        })
        statusRes = self.DracraysConnObj.getDownloadStatus(
            requestsStatusObj).__dict__
        for _ in range(10):
            if statusRes['downloadReportJobStatus'] != 2 and statusRes[
                    'downloadReportJobStatus'] != 1:
                time.sleep(1)
                statusRes = self.DracraysConnObj.getDownloadStatus(
                    requestsStatusObj).__dict__
            else:
                break
    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')
Пример #17
0
    def test_LUCI_IMC_DCP_017(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {'client_handling_type': 'DISC_CODE_PIN'})
        LuciHelper.couponPumpAssertion(self, couponSeriesId, isDiscCode=False)

        exceptionList = LuciHelper.issueMultipleCoupon(
            self,
            couponSeriesId,
            self.userIds,
            expectResponseException=[True, 'coupons exhausted'])
        Assertion.constructAssertion(
            len(self.userIds) == len(exceptionList),
            'Uploaded and Issued Coupons : {} and Coupon Exhausted Exception : {}'
            .format(len(self.userIds), len(exceptionList)))
    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)))
Пример #19
0
    def test_LUCI_IMC_DCP_015(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'client_handling_type': 'DISC_CODE_PIN',
                'do_not_resend_existing_voucher': True,
                'allow_multiple_vouchers_per_user': False
            })
        LuciHelper.couponPumpAssertion(self, couponSeriesId, isDiscCode=False)
        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=10)

        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_IMC_DCP_012(self, description):
        try:
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                self,
                couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})
            LuciHelper.couponPumpAssertion(self, couponSeriesId, False)
            noOfCouponUpload = 100
            noOfCouponToBeIssue = 120

            LuciHelper.uploadCouponAndAssertions(
                self,
                couponSeriesId,
                self.constructObj.importType['NONE'],
                noOfCouponsToBeUpload=noOfCouponUpload)

            time.sleep(2)
            createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
                couponSeriesId, 1)
            Assertion.constructAssertion(
                createdCouponCount == noOfCouponUpload,
                'Uploaded coupon & Valid coupon in DB count Mismatch Actual : {} and Expected : {}'
                .format(createdCouponCount, noOfCouponUpload))
            queueCount = self.connObj.getQueueSize(
                constant.config['orgId'], couponSeriesId,
                constant.config['requestId'])
            Assertion.constructAssertion(
                queueCount == noOfCouponUpload,
                'Uploaded coupon and Queued Coupon count is Mismatch Actual : {} and Expected : {}'
                .format(queueCount, noOfCouponUpload))

            LuciDBHelper.getUsers(noOfCouponToBeIssue)
            for i in range(len(constant.config['usersInfo'])):
                self.bulkUserIds.append(
                    constant.config['usersInfo'][i]['userId'])
            exceptionList = LuciHelper.issueMultipleCoupon(
                self,
                couponSeriesId,
                self.bulkUserIds,
                expectResponseException=[True, 'coupons exhausted'])
            Assertion.constructAssertion(
                (noOfCouponToBeIssue - noOfCouponUpload) == len(exceptionList),
                'Uploaded and Issued Coupons : {} and Coupon Exhausted Exception : {}'
                .format(noOfCouponUpload, len(exceptionList)))
        finally:
            del constant.config['usersInfo'][10:]
Пример #21
0
    def test_LUCI_IMC_DCP_018(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'client_handling_type': 'DISC_CODE_PIN',
                'max_create': 5
            })
        LuciHelper.couponPumpAssertion(self, couponSeriesId, isDiscCode=False)
        noOfCouponUpload = 5
        # upload the coupon code
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=noOfCouponUpload)

        maxCouponSeries = LuciHelper.issueMultipleCoupon(
            self,
            couponSeriesId,
            self.userIds,
            expectResponseException=[True, 'max create for series exceeded'])
        Assertion.constructAssertion(
            len(maxCouponSeries) == noOfCouponUpload,
            'Max Create for series Exceeded Exception for Users')
Пример #22
0
 def test_LUCI_IMC_GC_10(self, description, couponConfig):
     couponCode = LuciHelper.generateCouponCode()
     couponConfig.update({'client_handling_type': 'GENERIC', 'genericCode': couponCode})
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfig)
     LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds, expectResponseException=[True,'coupon series expired'])
Пример #23
0
    def test_LUCI_IMC_GC_04(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'GENERIC', 'genericCode': couponCode, 'do_not_resend_existing_voucher': False, 'allow_multiple_vouchers_per_user': False})

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