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