Exemplo n.º 1
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']))
Exemplo n.º 2
0
    def test_LUCI_EI_013_02(self, description):
        config = {
            'client_handling_type': 'DISC_CODE_PIN',
            'any_user': False,
            'isExternalIssual': False
        }
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=config)
        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=10,
            dracraysUpload={'couponCodeCAPS': False})

        time.sleep(10)

        queueSize = LuciHelper.getQueueSize(self, couponSeriesId)
        Assertion.constructAssertion(
            queueSize == 10,
            'External Coupons not pumped to Queue Actual: {}'.format(
                queueSize))

        couponCode, _ = LuciHelper.issueCouponAndAssertions(
            self, couponSeriesId)
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
Exemplo n.º 3
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')
Exemplo n.º 4
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)
Exemplo n.º 5
0
    def test_LUCI_IC_DCP_025_sanity(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})
        time.sleep(2)
        LuciHelper.couponPumpAssertion(self, couponSeriesId, isDiscCode=False)
        LuciHelper.uploadCouponAndAssertions(
            self, couponSeriesId, self.constructObj.importType['NONE'])

        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')

        #Update Coupon series & issue coupon check queue size
        LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=couponConfigObj)
        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,
            'Coupon Queue count deducted with No. of Issued Coupons')
Exemplo n.º 6
0
    def test_LUCI_IC_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
            })

        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount == 0,
                                     'Coupons are created for DCP')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupons not pumped to queue')

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

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        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']))
Exemplo n.º 7
0
    def test_LUCI_IC_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
            })

        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount == 0,
                                     'Coupons are created for DCP')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupons not pumped to queue')

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

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        LuciHelper.issueCouponAndAssertions(self,
                                            couponSeriesId,
                                            couponIssuedCount=2)
Exemplo n.º 8
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']))
Exemplo n.º 9
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')
Exemplo n.º 10
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']))
Exemplo n.º 11
0
 def test_LUCI_UC_03(self, description, couponConfig, expectedErrorMsg):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfig)
     LuciHelper.uploadCouponAndAssertions(self, couponSeriesId, self.constructObj.importType['USER_ID'], self.userId, noOfCouponsToBeUpload=1)
     for uploadType in self.uploadTypeList:
         response = LuciHelper.uploadCouponAndAssertions(self,couponSeriesId, self.constructObj.importType[uploadType],self.userId, noOfCouponsToBeUpload=1, dracraysUpload={'errorCount' : 1})
         for errorMsg in response['errors']:
             Assertion.constructAssertion(errorMsg['ErrorMsg'] == expectedErrorMsg, 'Error Message is Mismatch Actual : {} and Expected: {}'.format(errorMsg['ErrorMsg'], expectedErrorMsg))
             Assertion.constructAssertion(errorMsg['UserId'] == self.userId, 'UserId is Mismatch Actual : {} and Expected: {}'.format(errorMsg['UserId'], self.userId))
     LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,1,0)
Exemplo n.º 12
0
    def test_LUCI_EI_013(self, description, config):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=config)
        Assertion.constructAssertion(
            LuciDBHelper.isExternalCouponSeries(couponSeriesId),
            'Client handling type isExternal Enabled for coupon series id: {}'.
            format(couponSeriesId))
        Assertion.constructAssertion(
            couponConfigObj['client_handling_type'] == 'DISC_CODE_PIN',
            'External coupon series Client handling type Matched Actual: {} and Expected: {}'
            .format(couponConfigObj['client_handling_type'], 'DISC_CODE_PIN'))

        couponCodeList = LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=10,
            dracraysUpload={'couponCodeCAPS': False})['coupons']
        queueSize = LuciHelper.getQueueSize(self, couponSeriesId)
        Assertion.constructAssertion(
            queueSize == 0,
            'External Coupons not pumped to Queue Actual: {}'.format(
                queueSize))
        issuedCount = LuciDBHelper.getCouponsIssued_Count(couponSeriesId)
        Assertion.constructAssertion(
            issuedCount == 10,
            'Uploaded External Coupons & Issued DB count Matched Actual: {} and Expected: {}'
            .format(issuedCount, 10))
        LuciHelper.redeemCouponAndAssertions(self,
                                             couponSeriesId,
                                             couponCodeList[0],
                                             couponIssuedTo=[-1])
        couponConfigObj.update({'any_user': False, 'isExternalIssual': False})
        LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=couponConfigObj)

        LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            noOfCouponsToBeUpload=10,
            dracraysUpload={'couponCodeCAPS': False})

        queueSize = LuciHelper.getQueueSize(self, couponSeriesId)
        Assertion.constructAssertion(
            queueSize == 10,
            'External Coupons not pumped to Queue Actual: {}'.format(
                queueSize))

        couponCode, _ = LuciHelper.issueCouponAndAssertions(
            self, couponSeriesId)
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
        queueSize = LuciHelper.getQueueSize(self, couponSeriesId)
        Assertion.constructAssertion(
            queueSize == 9,
            'External Coupons not pumped to Queue Actual: {}'.format(
                queueSize))
Exemplo n.º 13
0
    def test_LUCI_UC_08(self, description, uploadType, expectedErrorMsg):
        #Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})

        LuciHelper.uploadCouponAndAssertions(self,couponSeriesId, self.constructObj.importType[uploadType],self.userId, noOfCouponsToBeUpload=2)
        LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,2,0)
        response = LuciHelper.uploadCouponAndAssertions(self, couponSeriesId, self.constructObj.importType[uploadType], self.userId, noOfCouponsToBeUpload=2, dracraysUpload={'errorCount': 2, 'invalidCase': [True, True]})
        for errorMsg in response['errors']:
            Assertion.constructAssertion(errorMsg['ErrorMsg'] == expectedErrorMsg, 'Error Message is Mismatch Actual : {} and Expected: {}'.format(errorMsg['ErrorMsg'], expectedErrorMsg))
Exemplo n.º 14
0
    def test_LUCI_UC_09(self, description, uploadType, expectedErrorMsg):
        #Save Coupon Config
        mutualCouponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})[1]

        LuciHelper.uploadCouponAndAssertions(self,mutualCouponSeriesId, self.constructObj.importType[uploadType],self.userId, noOfCouponsToBeUpload=2)
        LuciHelper.getCouponConfigAndAssertion(self,mutualCouponSeriesId,2,0)
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN', 'mutual_exclusive_series_ids' : '[' + str(mutualCouponSeriesId) + ']'})
        response = LuciHelper.uploadCouponAndAssertions(self, couponSeriesId, self.constructObj.importType[uploadType], self.userId, noOfCouponsToBeUpload=2, dracraysUpload={'errorCount': 2})
        for errorMsg in response['errors']:
            Assertion.constructAssertion(errorMsg['ErrorMsg'] == expectedErrorMsg, 'Error Message is Mismatch Actual : {} and Expected: {}'.format(errorMsg['ErrorMsg'], expectedErrorMsg))
Exemplo n.º 15
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')
Exemplo n.º 16
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']
 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)
Exemplo n.º 18
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')
Exemplo n.º 19
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:]
Exemplo n.º 20
0
    def test_downloadCoupon_DCP(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {'client_handling_type': 'DISC_CODE_PIN'})

        LuciHelper.uploadCouponAndAssertions(self,
                                             couponSeriesId,
                                             2,
                                             noOfCouponsToBeUpload=2)
        # Issue Coupon Code
        couponCode = LuciHelper.issueCouponAndAssertions(self,
                                                         couponSeriesId)[0]
        DracarysHelper.downloadCouponsRequestAndAssertion(
            self, couponSeriesId,
            self.DracarysObj.DownloadReportType['ISSUED'], [couponCode])
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
        DracarysHelper.downloadCouponsRequestAndAssertion(
            self, couponSeriesId,
            self.DracarysObj.DownloadReportType['REDEEMED'], [couponCode])
Exemplo n.º 21
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)
Exemplo n.º 22
0
 def test_LUCI_UC_02_sanity(self, description, uploadType):
     #Save Coupon Config
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})
     # upload coupon Code to user1
     response = LuciHelper.uploadCouponAndAssertions(self,couponSeriesId, self.constructObj.importType[uploadType],self.userId, noOfCouponsToBeUpload=2, dracraysUpload={'errorCount' : 2, 'invalidCase' : [True, False]})
     for errorMsg in response['errors']:
         Assertion.constructAssertion(errorMsg['ErrorMsg'] == 'duplicate users provided in the same file', 'Error Message is Mismatch Actual : {} and Expected: {}'.format(errorMsg['ErrorMsg'], 'duplicate users provided in the same file'))
         Assertion.constructAssertion(errorMsg['UserId'] == self.userId, 'UserId is Mismatch Actual : {} and Expected: {}'.format(errorMsg['UserId'], self.userId))
     LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,1,0)
    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)
Exemplo n.º 24
0
 def test_LUCI_UC_01(self,description, couponConfig, uploadType, dracarysUploadInput):
     #Save Coupon Config
     for i in range(5):
         self.userIds.append(constant.config['usersInfo'][i]['userId'])
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)
     time.sleep(2)
     couponCodeList = LuciHelper.uploadCouponAndAssertions(self,couponSeriesId, self.constructObj.importType[uploadType],noOfCouponsToBeUpload=5, dracraysUpload=dracarysUploadInput)['coupons']
     Logger.log('Coupon Code list : ', couponCodeList)
     for couponCode, self.userId in zip(couponCodeList,self.userIds):
         LuciHelper.getCouponDetailsAndAssertion(self,couponSeriesId,couponCode, couponDetailsRequest={'onlyActive': True, 'couponCodeFilter': [couponCode]})
     LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,5,0)
Exemplo n.º 25
0
    def test_LUCI_IC_DCP_020(self, description, invalidInput, expected):
        try:
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                self, {'client_handling_type': 'DISC_CODE_PIN'})
            # upload the coupon code
            LuciHelper.uploadCouponAndAssertions(
                self, couponSeriesId, self.constructObj.importType['NONE'])

            LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId, issueCouponParamObj=invalidInput)
        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']))
Exemplo n.º 26
0
 def test_LUCI_UC_04(self, description, uploadType):
     #Save Coupon Config
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'client_handling_type': 'DISC_CODE_PIN'})
     # upload coupon Code to user1
     response = LuciHelper.uploadCouponAndAssertions(self,couponSeriesId, self.constructObj.importType[uploadType],self.userId, noOfCouponsToBeUpload=2, dracraysUpload={'errorCount' : 2, 'invalidCase' : [True, False]})
     for errorMsg in response['errors']:
         Assertion.constructAssertion(errorMsg['ErrorMsg'] == 'duplicate coupons provided in the same file', 'Error Message is Mismatch Actual : {} and Expected: {}'.format(errorMsg['ErrorMsg'], 'duplicate coupons provided in the same file'))
     LuciHelper.getCouponConfigAndAssertion(self,couponSeriesId,0,0)
     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')
Exemplo n.º 27
0
    def test_downloadCoupon_issued_24HR(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {'client_handling_type': 'DISC_CODE_PIN'})

        LuciHelper.uploadCouponAndAssertions(self,
                                             couponSeriesId,
                                             2,
                                             noOfCouponsToBeUpload=2)
        # Issue Coupon Code
        couponCode, couponDetails = LuciHelper.issueCouponAndAssertions(
            self, couponSeriesId)
        changeDate = Utils.getTime(days=-1, minutes=-5, milliSeconds=True)
        self.connObj.changeCouponIssuedDate(couponDetails['id'], changeDate)
        DracarysHelper.downloadCouponsRequestAndAssertion(
            self, couponSeriesId,
            self.DracarysObj.DownloadReportType['ISSUED'], [])
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
        DracarysHelper.downloadCouponsRequestAndAssertion(
            self, couponSeriesId,
            self.DracarysObj.DownloadReportType['REDEEMED'], [couponCode])
Exemplo n.º 28
0
    def test_LUCI_IC_DCP_018(self, description):
        actualUserId = self.userId
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {
                'client_handling_type': 'DISC_CODE_PIN',
                'max_create': 1
            })

        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount == 0,
                                     'Coupons are created for DCP')
        Assertion.constructAssertion(
            self.connObj.getQueueSize(constant.config['orgId'], couponSeriesId,
                                      constant.config['requestId']) == 0,
            'Coupons not pumped to queue')

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

        LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
        self.userId = constant.config['usersInfo'][1]['userId']
        luciExp = LuciHelper.issueCouponAndAssertions(self,
                                                      couponSeriesId,
                                                      expectException=True)
        Assertion.constructAssertion(
            luciExp['errorCode'] ==
            constant.MAX_COUPON_ISSUAL_PER_SERIES_EXCEEDED,
            'Luci Exception error code Actual: {} and Expected: {}'.format(
                luciExp['errorCode'],
                constant.MAX_COUPON_ISSUAL_PER_SERIES_EXCEEDED))
        Assertion.constructAssertion(
            luciExp['errorMsg'] == 'max create for series exceeded',
            'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))
        self.userId = actualUserId
 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)
Exemplo n.º 30
0
 def test_LUCI_DCP_DTZ(self, description):
     try:
         self.tillId = LuciDBHelper.getTillDiffTimeZone()
         couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
             self,
             couponConfigReq={
                 'client_handling_type': 'DISC_CODE_PIN',
                 'min_days_between_vouchers': 1,
                 'do_not_resend_existing_voucher': True,
                 'allow_multiple_vouchers_per_user': True
             })
         LuciHelper.uploadCouponAndAssertions(
             self,
             couponSeriesId,
             self.constructObj.importType['NONE'],
             noOfCouponsToBeUpload=10)
         LuciHelper.issueCouponAndAssertions(self, couponSeriesId)
         luciExp = LuciHelper.issueCouponAndAssertions(
             self,
             couponSeriesId,
             issueCouponParamObj={
                 'eventTimeInMillis': Utils.getTime(days=-1,
                                                    milliSeconds=True)
             },
             expectException=True)
         Assertion.constructAssertion(
             luciExp['errorCode'] ==
             constant.DAYS_BETWEEN_ISSUAL_FOR_USER_LOWER_MIN_DAYS,
             'Luci Exception error code Actual: {} and Expected: {}'.format(
                 luciExp['errorCode'],
                 constant.DAYS_BETWEEN_ISSUAL_FOR_USER_LOWER_MIN_DAYS))
         Assertion.constructAssertion(
             luciExp['errorMsg'] ==
             'days between consecutive issuals for a user less than min days between issuals',
             'Luci Exception Error Msg Actual : {}'.format(
                 luciExp['errorMsg']))
     finally:
         self.tillId = constant.config['tillIds'][0]