コード例 #1
0
ファイル: test_pointsReversal.py プロジェクト: anupsl/pyApps
    def test_LYT_RED_REVERSE_02(self, description, pointToReverse):
        uniqueRedemptionId = []
        redemptionId = []
        initialRedeemedPoints = LoyaltyDBHelper.getSumOfPointsAwarded(
            self.customerId)['sumOfRedeemedValue']
        noOfRedeem = 2
        for i in range(noOfRedeem):
            redeemPointsResponse = LoyaltyHelper.pointsRedemptionAndAssertion(
                self, pointToReverse,
                (initialRedeemedPoints + (i * pointToReverse)))
            uniqueRedemptionId.append(
                redeemPointsResponse['uniqueRedemptionId'])

        time.sleep(1)
        LoyaltyHelper.simplePropertiesParser(
            self.EMFConnObj.newBillEvent(
                EMFObject.NewBillEvent(
                    {'uniqueRedemptionId': uniqueRedemptionId})).__dict__)
        prsDBDetails = LoyaltyDBHelper.getPointsRedemptionSummary(
            self.customerId, self.storeId,
            {'redemptionIds': uniqueRedemptionId})
        Assertion.constructAssertion(
            len(prsDBDetails) == len(uniqueRedemptionId),
            'No of Records added to prs Actual: {} and Expected: {}'.format(
                len(prsDBDetails), len(uniqueRedemptionId)))
        for prs in prsDBDetails:
            Assertion.constructAssertion(
                prs['billId'] == constant.config['billNumber'],
                'RedemptionId updated to prs with BillId Actual: {} and Expected: {}'
                .format(prs['billId'], constant.config['billNumber']))
            Assertion.constructAssertion(
                prs['redemption_id'] in uniqueRedemptionId,
                'Unique Redemption Id is match with BillIds Actual: {} and Expected: {}'
                .format(prs['redemption_id'], uniqueRedemptionId))
            Assertion.constructAssertion(
                prs['redemptionType'] == 'REDEMPTION',
                'Redemption type is Matched Actual: {} and Expected: {}'.
                format(prs['redemptionType'], 'REDEMPTION'))
            redemptionId.append(prs['prs_id'])

        parsedResponse = LoyaltyHelper.redemptionReversalAndAssertion(
            self, [uniqueRedemptionId[0]])
        LoyaltyHelper.redemptionReversalDBAssertion(
            self, redemptionId, parsedResponse['redemptionReversalId'],
            (initialRedeemedPoints + pointToReverse))
        self.pointEngineConnObj.getPointsRedemptionSummaryForCustomer(
            self.orgId, self.customerId, True)
コード例 #2
0
ファイル: test_pointsReversal.py プロジェクト: anupsl/pyApps
 def test_LYT_RED_REVERSE_03(self, description):
     initialRedeemedPoints = LoyaltyDBHelper.getSumOfPointsAwarded(
         self.customerId)['sumOfRedeemedValue']
     ptsRedemptionResponse = LoyaltyHelper.pointsRedemptionAndAssertion(
         self, constant.config['defaultRedeemPts'], initialRedeemedPoints)
     time.sleep(1)
     self.EMFConnObj.newBillEvent(
         EMFObject.NewBillEvent({
             'uniqueRedemptionId':
             ptsRedemptionResponse['uniqueRedemptionId']
         }))
     parsedResponse = LoyaltyHelper.redemptionReversalAndAssertion(
         self, [ptsRedemptionResponse['uniqueRedemptionId']])
     LoyaltyHelper.redemptionReversalDBAssertion(
         self, ptsRedemptionResponse['pointsRedemptionSummaryId'],
         parsedResponse['redemptionReversalId'], initialRedeemedPoints)
     LoyaltyHelper.redemptionReversalAndAssertion(
         self, [ptsRedemptionResponse['uniqueRedemptionId']],
         expectException=[3802, "all redeemed points already reversed"])
コード例 #3
0
ファイル: test_pointsReversal.py プロジェクト: anupsl/pyApps
    def test_LYT_RED_REVERSE_06(self, description):
        redemptionId = []
        initialRedeemedPoints = LoyaltyDBHelper.getSumOfPointsAwarded(
            self.customerId)['sumOfRedeemedValue']
        uniqueRedemptionId = LoyaltyHelper.pointsRedemptionAndAssertion(
            self, constant.config['defaultRedeemPts'], initialRedeemedPoints,
            {'redeemedOnBillId': -1})['uniqueRedemptionId']

        prsDBDetails = LoyaltyDBHelper.getPointsRedemptionSummary(
            self.customerId, self.storeId,
            {'redemptionIds': uniqueRedemptionId})
        Assertion.constructAssertion(
            len(prsDBDetails) == len([uniqueRedemptionId]),
            'No of Records added to prs Actual: {} and Expected: {}'.format(
                len(prsDBDetails), len(uniqueRedemptionId)))
        for prs in prsDBDetails:
            Assertion.constructAssertion(
                prs['billId'] == -1,
                'RedemptionId updated to prs with BillId Actual: {} and Expected: {}'
                .format(prs['billId'], constant.config['billNumber']))
            Assertion.constructAssertion(
                prs['redemption_id'] in uniqueRedemptionId,
                'Unique Redemption Id is match with BillIds Actual: {} and Expected: {}'
                .format(prs['redemption_id'], uniqueRedemptionId))
            Assertion.constructAssertion(
                prs['redemptionType'] == 'REDEMPTION',
                'Redemption type is Matched Actual: {} and Expected: {}'.
                format(prs['redemptionType'], 'REDEMPTION'))
            redemptionId.append(prs['prs_id'])

        parsedResponse = LoyaltyHelper.redemptionReversalAndAssertion(
            self, [uniqueRedemptionId])
        LoyaltyHelper.redemptionReversalDBAssertion(
            self, redemptionId, parsedResponse['redemptionReversalId'],
            initialRedeemedPoints)
        LoyaltyHelper.redemptionReversalAndAssertion(
            self,
            listOfRedemptionId=[parsedResponse['redemptionReversalId']],
            expectException=[
                3804, 'redemption reversal of a reversal not allowed'
            ])
コード例 #4
0
ファイル: test_pointsReversal.py プロジェクト: anupsl/pyApps
 def test_LYT_RED_REVERSE_05(self, description, pointsToBeReversed):
     time.sleep(1)
     billId = int(
         LoyaltyHelper.simplePropertiesParser(
             self.EMFConnObj.newBillEvent(
                 EMFObject.NewBillEvent()).__dict__)['sourceId'])
     initialRedeemedPoints = LoyaltyDBHelper.getSumOfPointsAwarded(
         self.customerId)['sumOfRedeemedValue']
     redemptionId = []
     uniqueRedemptionId = LoyaltyHelper.pointsRedemptionAndAssertion(
         self, constant.config['defaultRedeemPts'], initialRedeemedPoints,
         {'redeemedOnBillId': billId})['uniqueRedemptionId']
     prsDBDetails = LoyaltyDBHelper.getPointsRedemptionSummary(
         self.customerId, self.storeId,
         {'redemptionIds': uniqueRedemptionId})
     Assertion.constructAssertion(
         len(prsDBDetails) == len([uniqueRedemptionId]),
         'No of Records added to prs Actual: {} and Expected: {}'.format(
             len(prsDBDetails), len(uniqueRedemptionId)))
     for prs in prsDBDetails:
         Assertion.constructAssertion(
             prs['billId'] == billId,
             'RedemptionId updated to prs with BillId Actual: {} and Expected: {}'
             .format(prs['billId'], billId))
         Assertion.constructAssertion(
             prs['redemption_id'] in uniqueRedemptionId,
             'Unique Redemption Id is match with BillIds Actual: {} and Expected: {}'
             .format(prs['redemption_id'], uniqueRedemptionId))
         Assertion.constructAssertion(
             prs['redemptionType'] == 'REDEMPTION',
             'Redemption type is Matched Actual: {} and Expected: {}'.
             format(prs['redemptionType'], 'REDEMPTION'))
         redemptionId.append(prs['prs_id'])
     parsedResponse = LoyaltyHelper.redemptionReversalAndAssertion(
         self, [uniqueRedemptionId],
         {'pointsToBeReversed': pointsToBeReversed})
     LoyaltyHelper.redemptionReversalDBAssertion(
         self, redemptionId, parsedResponse['redemptionReversalId'],
         initialRedeemedPoints, pointsToBeReversed)