Ejemplo 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']))
Ejemplo n.º 2
0
 def test_LUCI_CF_018(self, description, couponConfig, claimObject,
                      validTillDay):
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
         self, couponConfig)
     LuciHelper.claimCouponSeries(self, couponSeriesId, claimObject)
     couponConfigObj = LuciHelper.getCouponConfigAndAssertion(
         self, couponSeriesId, 0, 0)
     Assertion.constructAssertion(
         long(couponConfigObj['ownerValidity']) > 0,
         'Owner Validity is set Actual: {}'.format(
             couponConfigObj['ownerValidity']))
     couponConfigObj.update({
         'valid_till_date':
         Utils.getTime(days=validTillDay, milliSeconds=True),
         'ownerValidity':
         Utils.getTime(days=validTillDay, milliSeconds=True)
     })
     LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj)
     couponConfigObj = LuciHelper.getCouponConfigAndAssertion(
         self, couponSeriesId, 0, 0)
     Assertion.constructAssertion(
         long(couponConfigObj['valid_till_date']) > 0,
         'valid_till_date is set Actual: {}'.format(
             couponConfigObj['valid_till_date']))
     Assertion.constructAssertion(
         long(couponConfigObj['ownerValidity']) > 0,
         'Owner Validity is set Actual: {}'.format(
             couponConfigObj['ownerValidity']))
Ejemplo n.º 3
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 ')
Ejemplo n.º 4
0
    def test_LUCI_GCD_025(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True, 'redeem_at_store' : str([self.tillId])})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]

        transNum1 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1)['transactionNumber']
        time.sleep(1)
        self.billId = Utils.getTime(milliSeconds=True)
        transNum2 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2)['transactionNumber']

        # coupon Search and Assertion
        redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber': [transNum1]})
        issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]})
        couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1])

        redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber': [transNum2]})
        issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]})
        couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode2])

        redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber': [transNum1, transNum2]})
        issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]})
        couponSearchRequest = {'redemptionFilters': redemptionFiltersObj, 'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1, couponCode2])
Ejemplo n.º 5
0
    def test_LUCI_GCD_016(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True,
                                'same_user_multiple_redeem': True, 'multiple_use': True})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]

        redeemedDate1 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1)['redemptionDate']
        time.sleep(2)
        self.billId = Utils.getTime(milliSeconds=True)
        redeemedDate2 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2)['redemptionDate']

        # coupon Search and Assertion
        redemptionFiltersObj = LuciObject.redemptionFilters({'redemptionDateStart': (redeemedDate1 - 1000),'redemptionDateEnd': (redeemedDate1 + 1000)})
        redemptionFiltersObj = {'redemptionFilters': redemptionFiltersObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1])

        redemptionFiltersObj = LuciObject.redemptionFilters({'redemptionDateStart': (redeemedDate2 - 1000),'redemptionDateEnd': (redeemedDate2 + 1000)})
        redemptionFiltersObj = {'redemptionFilters': redemptionFiltersObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode2])

        redemptionFiltersObj = LuciObject.redemptionFilters({'redemptionDateStart': (redeemedDate1 - 1000),'redemptionDateEnd': (redeemedDate2 + 1000)})
        redemptionFiltersObj = {'redemptionFilters': redemptionFiltersObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1, couponCode2])
Ejemplo n.º 6
0
    def test_LUCI_GCD_026(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True, 'redeem_at_store' : str([self.tillId])})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        time.sleep(2)
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        time.sleep(2)
        couponCode3 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        time.sleep(2)
        couponCode4 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        time.sleep(2)
        couponCode5 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]

        couponSearchRequest = {'offset' : 2, 'limit' : 2, 'sort' : self.constructObj.sort['DESC']}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode3,couponCode2])

        couponSearchRequest = {'offset': 1}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode2, couponCode3,couponCode4,couponCode5])

        couponSearchRequest = {'limit': 3}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1, couponCode2,couponCode3])
Ejemplo n.º 7
0
    def test_LUCI_GCD_029(self):
        # Save Coupon Config
        try:
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

            couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True, 'redeem_at_store': str([self.tillId])})
            couponConfigObj = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj)[0]

            couponCode1 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
            couponSearchRequest = {'sort': self.constructObj.sort['DESC'], 'couponSeriesType': self.constructObj.couponSeriesType['CAMPAIGN']}
            LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode1])
            time.sleep(2)

            couponConfigObj.update({'series_type': 'DVS'})
            couponConfigObj = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfigObj)[0]
            couponCode2 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
            couponSearchRequest = {'sort': self.constructObj.sort['DESC'], 'couponSeriesType': self.constructObj.couponSeriesType['DVS']}
            LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode2, couponCode1])
            time.sleep(2)

            couponConfigObj.update({'series_type': 'GOODWILL'})
            LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfigObj)
            couponCode3 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
            couponSearchRequest = {'sort': self.constructObj.sort['DESC'], 'couponSeriesType': self.constructObj.couponSeriesType['GOODWILL']}
            LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], couponSearchRequest, [couponCode3, couponCode2, couponCode1])
        except Exception, luciExp:
            Logger.log('Luci Exception : ' , luciExp)
            luciExp = luciExp.__dict__
            Assertion.constructAssertion(luciExp['errorCode'] == constant.INVALID_INPUT, 'Luci Exception error code Actual: {} and Expected: {}'.format(luciExp['errorCode'], constant.INVALID_INPUT))
            Assertion.constructAssertion(luciExp['errorMsg'] == 'series type and owned by should be same', 'Luci Exception Error Msg Actual : {}'.format(luciExp['errorMsg']))
Ejemplo n.º 8
0
    def test_LUCI_GCD_013(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user' : True, 'do_not_resend_existing_voucher' : True})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1, detailsDict = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)
        issualStartTime1 = detailsDict['issuedDate']
        issualEndTime1 = issualStartTime1 + 4000

        # coupon Search and Assertion
        issualFilterObj = LuciObject.issualFilters({'issualDateStart': (issualStartTime1 - 2000), 'issualDateEnd' : (issualEndTime1 + 2000)})
        issualFilterObj = {'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], issualFilterObj, [couponCode1])

        time.sleep(4)
        couponCode2, detailsDict = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)
        issualStartTime2 = detailsDict['issuedDate']
        issualEndTime2 = issualStartTime2 + 4000

        # coupon Search and Assertion
        issualFilterObj = LuciObject.issualFilters({'issualDateStart': (issualStartTime2-2000), 'issualDateEnd' : (issualEndTime2 + 2000)})
        issualFilterObj = {'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], issualFilterObj, [couponCode2])


        # coupon Search and Assertion
        issualFilterObj = LuciObject.issualFilters({'issualDateStart': (issualStartTime1-2000), 'issualDateEnd' : (issualEndTime2 + 2000)})
        issualFilterObj = {'issualFilters': issualFilterObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], issualFilterObj, [couponCode1,couponCode2])
Ejemplo n.º 9
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')
Ejemplo n.º 10
0
    def test_LUCI_GCD_015(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user' : True, 'do_not_resend_existing_voucher' : True,
                                'same_user_multiple_redeem' : True,'multiple_use' : True})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]

        transNum1 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode1)['transactionNumber']
        time.sleep(1)
        self.billId = Utils.getTime(milliSeconds=True)
        transNum2 = LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode2)['transactionNumber']

        time.sleep(1)
        # coupon Search and Assertion
        redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber' : [transNum1]})
        redemptionFiltersObj = {'redemptionFilters' : redemptionFiltersObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1])

        redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber' : [transNum2]})
        redemptionFiltersObj = {'redemptionFilters' : redemptionFiltersObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode2])

        redemptionFiltersObj = LuciObject.redemptionFilters({'transactionNumber' : [transNum1,transNum2]})
        redemptionFiltersObj = {'redemptionFilters' : redemptionFiltersObj}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], redemptionFiltersObj, [couponCode1, couponCode2])
Ejemplo n.º 11
0
    def test_MULTI_INSTANCE_SCC_UCC_GCC_001(self, description):
        Logger.log('starting test_SCC_UCC_GCC_01_MULTI_INSTANCE execution')
        if not LuciHelper.verifyLuciServicesCount(2):
            pytest.skip("test requires minimum of 2 luci services running")

        self.connObj = LuciHelper.getFirstConn(newConnection=True)
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)

        time.sleep(2)
        # update coupon config after some time on second server
        self.connObj = LuciHelper.getSecondConn(newConnection=True)
        dat = datetime.datetime.now() + datetime.timedelta(days=3)
        owner_validity = int(time.mktime(dat.timetuple()) * 1e3)
        couponConfigObj.update({
            'alphaNumeric': False,
            'shortCodeLength': 4,
            'ownerValidity': owner_validity,
            'max_vouchers_per_user': 5
        })
        LuciHelper.saveCouponConfigAndAssertions(self, couponConfigObj)

        # get updated coupon config on second server
        config1 = LuciHelper.getCouponConfigAndAssertion(self, couponSeriesId)
        Assertion.constructAssertion(config1['alphaNumeric'] is False,
                                     'alphanumeric config key updated')
        Assertion.constructAssertion(config1['shortCodeLength'] == 4,
                                     'short code length updated')
        Assertion.constructAssertion(
            config1['ownerValidity'] == owner_validity,
            'owner validity is updated')
        Assertion.constructAssertion(config1['max_vouchers_per_user'] == 5,
                                     'max voucher per user is updated')

        # wait for coupon config to change on first server
        self.connObj = LuciHelper.getFirstConn(newConnection=True)
        configChanged = False
        config2 = None
        for _ in range(7):
            config2 = LuciHelper.getCouponConfigAndAssertion(
                self, couponSeriesId)
            if config2['alphaNumeric'] is not None:
                configChanged = True
                break
            time.sleep(10)

        if configChanged is True:
            Assertion.constructAssertion(config2['alphaNumeric'] is False,
                                         'alphanumeric config key updated')
            Assertion.constructAssertion(config2['shortCodeLength'] == 4,
                                         'short code length updated')
            Assertion.constructAssertion(
                config2['ownerValidity'] == owner_validity,
                'owner validity is updated')
            Assertion.constructAssertion(config2['max_vouchers_per_user'] == 5,
                                         'max voucher per user is updated')
        else:
            Assertion.constructAssertion(
                False, 'Coupon config is not updated in second server')
Ejemplo 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))
Ejemplo n.º 13
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))
Ejemplo n.º 14
0
    def test_LUCI_DC_013_sanity_smoke(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq={'client_handling_type' : 'DISC_CODE' , 'any_user' : True, 'min_bill_amount' : 1500 , 'max_bill_amount' : 999999999})
        time.sleep(2)
        couponCode = LuciHelper.issueCouponAndAssertions(self, couponSeriesId)[0]
        couponCode = couponCode.lower()
        # CouponDetails Request
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode, error=[900, 'bill amount less than the minimum limit set'])

        couponConfigObj.update({'min_bill_amount': 900})
        LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfigObj)
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)
Ejemplo 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')
Ejemplo n.º 16
0
    def test_LUCI_GCD_012(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'redeem_at_store' : str([self.tillId])})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        # Added Issue Filter
        issualFilterObj = LuciObject.issualFilters({'redeemableAtStoreId': [self.storeId]})
        issualFilterObj = {'issualFilters': issualFilterObj}
        #coupon Search and Assertion
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], issualFilterObj, [couponCode])
Ejemplo n.º 17
0
 def setup_class(self):
     Logger.logSuiteName(str(self).split('.')[-1])
     self.connObj = LuciHelper.getConnObj(newConnection=True)
     self.constructObj = LuciObject()
     self.userId = constant.config['usersInfo'][0]['userId']
     self.tillId = constant.config['tillIds'][0]
     self.storeId = constant.config['storeIds'][0]
     self.billId = Utils.getTime(milliSeconds=True)
     self.couponConfig1, self.couponSeriesId1 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN', 'created' : Utils.getTime(seconds=0, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8})
     self.couponConfig2, self.couponSeriesId2 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=1, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8})
     self.couponConfig3, self.couponSeriesId3 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=2, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8})
     self.couponConfig4, self.couponSeriesId4 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=3, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8})
     self.couponConfig5, self.couponSeriesId5 = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'DISC_CODE_PIN','created' : Utils.getTime(seconds=4, milliSeconds=True) ,'valid_till_date' : Utils.getTime(days=1, milliSeconds=True), 'alphaNumeric' : False, 'randomCodeLength' : 8})
Ejemplo n.º 18
0
    def test_LUCI_GCD_018(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True,
                                'same_user_multiple_redeem': True, 'multiple_use': True,})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        time.sleep(2)
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]

        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId],{'couponStatus': [self.constructObj.couponStatus['ACTIVE']],
                                          'sort': self.constructObj.sort['DESC']}, [couponCode2, couponCode1])
Ejemplo n.º 19
0
    def test_LUCI_GCD_019(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True,
                                'same_user_multiple_redeem': True, 'multiple_use': True, })
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        #issue and redeem the coupon code
        couponCode = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        LuciHelper.redeemCouponAndAssertions(self, couponSeriesId, couponCode)

        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId],{'couponStatus': [self.constructObj.couponStatus['REDEEMED']],
                                          'sort': self.constructObj.sort['DESC']}, [couponCode])
Ejemplo n.º 20
0
    def test_LUCI_GCD_034(self):
        # Save Coupon Config
        couponSeriesId1 = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'valid_days_from_create': 10, 'valid_till_date': Utils.getTime(days=5, milliSeconds=True)})[1]
        couponSeriesId2 = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'valid_days_from_create': 10, 'valid_till_date': Utils.getTime(days=6, milliSeconds=True)})[1]
        couponSeriesId3 = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq={'valid_days_from_create': 10, 'valid_till_date': Utils.getTime(days=2, milliSeconds=True)})[1]

        couponCode1 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId1)[0]
        couponCode2 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId2)[0]
        couponCode3 = LuciHelper.issueCouponAndAssertions(self, couponSeriesId3)[0]

        couponSearchRequest = {'orderBy': self.constructObj.orderBy['EXPIRY_DATE'], 'sort': self.constructObj.sort['DESC']}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId1, couponSeriesId2, couponSeriesId3], couponSearchRequest, [couponCode2, couponCode1, couponCode3])

        couponSearchRequest = {'orderBy': self.constructObj.orderBy['EXPIRY_DATE'], 'sort': self.constructObj.sort['ASC']}
        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId1, couponSeriesId2, couponSeriesId3], couponSearchRequest, [couponCode3, couponCode1, couponCode2])
Ejemplo n.º 21
0
    def test_LUCI_GCD_017(self):
        # Save Coupon Config
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self)

        couponConfigObj.update({'allow_multiple_vouchers_per_user': True, 'do_not_resend_existing_voucher': True,
                                'same_user_multiple_redeem': True, 'multiple_use': True,'valid_days_from_create' : -1,
                                'expiry_strategy_value' : -1})
        LuciHelper.saveCouponConfigAndAssertions(self,couponConfigObj)

        couponCode1 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]
        time.sleep(1)
        couponCode2 = LuciHelper.issueCouponAndAssertions(self,couponSeriesId)[0]

        LuciHelper.couponSearchAndAssertion(self, [couponSeriesId], {'couponStatus' : [self.constructObj.couponStatus['EXPIRED']],
                                'sort' : self.constructObj.sort['DESC']}, [couponCode2, couponCode1])
Ejemplo n.º 22
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']))
Ejemplo n.º 23
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']))
Ejemplo n.º 24
0
    def test_LUCI_PC_001(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self)

        time.sleep(10)
        count = 2500
        createCouponobj = LuciObject.couponCreateRequest({
            'couponSeriesId': couponSeriesId,
            'count': count
        })
        createCouponDict = self.connObj.createCoupons(createCouponobj).__dict__

        Assertion.constructAssertion(
            createCouponDict['statusCode'] == 1200,
            'CREATE COUPON STATUS CODE IS MISMATCH - ' +
            str(createCouponDict['statusCode']))
        Assertion.constructAssertion(
            createCouponDict['message'] == 'coupon pump successfully started',
            'CREATE COUPON CODE MESSAGE IS WRONG')
        time.sleep(5)

        createdCount = LuciDBHelper.getCouponsCreated_Count(couponSeriesId)
        Assertion.constructAssertion(
            createdCount >= count,
            'COUPON CREATED IS LESS THAN REQUEST COUNTS')
Ejemplo n.º 25
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)
Ejemplo n.º 26
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)
Ejemplo n.º 27
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)
Ejemplo n.º 28
0
    def test_LUCI_IC_DC_018(self, description):
        actualUserId = self.userId
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self, {'max_create': 1})
        time.sleep(2)
        createdCouponCount = LuciDBHelper.getCouponsCreated_Count(
            couponSeriesId, 1)
        Assertion.constructAssertion(createdCouponCount != 0,
                                     'Coupons 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']
        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
Ejemplo n.º 29
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)
Ejemplo n.º 30
0
    def test_downloadCoupon_Generic(self, description):
        try:
            couponCode = LuciHelper.generateCouponCode()
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                self, {
                    'client_handling_type': 'GENERIC',
                    'genericCode': couponCode
                })

            couponCode1 = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]
            self.userId = constant.config['usersInfo'][1]['userId']
            couponCode2 = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]
            DracarysHelper.downloadCouponsRequestAndAssertion(
                self, couponSeriesId,
                self.DracarysObj.DownloadReportType['ISSUED'],
                [couponCode1, couponCode2])
            LuciHelper.redeemCouponAndAssertions(self, couponSeriesId,
                                                 couponCode)
            DracarysHelper.downloadCouponsRequestAndAssertion(
                self, couponSeriesId,
                self.DracarysObj.DownloadReportType['REDEEMED'], [couponCode])
        finally:
            self.userId = constant.config['usersInfo'][0]['userId']