Example #1
0
 def test_unmatched_are_returned(self):
     """Test that unmatched lines are returned correctly."""
     data = {'check_number': '', 'date': self.day, 'type': 'deposit',
             'amount': 50}
     (matched, unmatched) = views._match_transactions(
         self.bank_account, [data])
     self.assertSequenceEqual(unmatched, [data])
     self.assertSequenceEqual(matched, [])
Example #2
0
 def test_items_matched_only_once(self):
     """Test that an existing Transaction is only matched Once."""
     data = {'check_number': '', 'date': self.day, 'type': 'deposit',
             'amount': 20}
     (matched, unmatched) = views._match_transactions(
         self.bank_account, [data, data])
     self.assertSequenceEqual(unmatched, [data])
     self.assertSequenceEqual(matched, [self.deposit_transaction])
Example #3
0
 def test_match_from_transfer_withdrawal(self):
     """Test that a Transfer Withdrawal's amount is correctly matched."""
     data = {'check_number': '', 'date': self.day, 'type':
             'transfer_withdrawal', 'amount': 30}
     (matched, unmatched) = views._match_transactions(
         self.bank_account, [data])
     self.assertSequenceEqual(unmatched, [])
     self.assertSequenceEqual(matched, [self.withdrawal_transfer])
Example #4
0
 def test_match_from_deposit(self):
     """Test that a Deposit's amount is correctly matched."""
     data = {'check_number': '', 'date': self.day, 'type': 'deposit',
             'amount': 20}
     (matched, unmatched) = views._match_transactions(
         self.bank_account, [data])
     self.assertSequenceEqual(unmatched, [])
     self.assertSequenceEqual(matched, [self.deposit_transaction])
Example #5
0
 def test_match_from_ach(self):
     """Test that check_number of 0 matches against ACH Payments."""
     data = {'check_number': '0', 'date': self.day, 'type': 'withdrawal',
             'amount': 20}
     (matched, unmatched) = views._match_transactions(
         self.bank_account, [data])
     self.assertSequenceEqual(unmatched, [])
     self.assertSequenceEqual(matched, [self.withdrawal_transaction])
Example #6
0
 def test_date_fuzzed_match(self):
     """Test that dates within a week are correctly matched."""
     time_diff = datetime.timedelta(days=7)
     data = {'check_number': '', 'date': self.day - time_diff,
             'type': 'deposit', 'amount': 20}
     (matched, unmatched) = views._match_transactions(
         self.bank_account, [data])
     self.assertSequenceEqual(unmatched, [])
     self.assertSequenceEqual(matched, [self.deposit_transaction])
Example #7
0
    def test_match_from_check(self):
        """Test that the check_number is matched against Payments."""
        self.withdrawal.ach_payment = False
        self.withdrawal.check_number = '42'
        self.withdrawal.save()

        data = {'check_number': '42', 'date': self.day, 'type': 'withdrawal',
                'amount': 20}
        (matched, unmatched) = views._match_transactions(
            self.bank_account, [data])
        self.assertSequenceEqual(unmatched, [])
        self.assertSequenceEqual(matched, [self.withdrawal_transaction])