Ejemplo n.º 1
0
 def test_transaction_line_validation_multi_none_passes(self):
     test_input = [("01-0101", 5), ("01-0102", 5), ("01-0103", -10),
                   ("01-0101", -5), ("01-0102", -5), ("01-0103", 10)]
     test_result = [
         Decimal(20),
         [
             {
                 'account': self.a1,
                 'value': Decimal(5)
             },
             {
                 'account': self.a2,
                 'value': Decimal(5)
             },
             {
                 'account': self.a3,
                 'value': Decimal(-10)
             },
             {
                 'account': self.a1,
                 'value': Decimal(-5)
             },
             {
                 'account': self.a2,
                 'value': Decimal(-5)
             },
             {
                 'account': self.a3,
                 'value': Decimal(10)
             },
         ]
     ]
     self.assertEqual(Transaction.line_validation(test_input), test_result)
Ejemplo n.º 2
0
 def test_transaction_line_validation_simple_xxi_input_passes(self):
     test_input = ("01-0100", "01-0101", int(5))
     test_result = (5, [{
         'account': self.a1,
         'value': 5
     }, {
         'account': self.a2,
         'value': -5
     }])
     self.assertEqual(Transaction.line_validation(test_input), test_result)
Ejemplo n.º 3
0
 def test_transaction_line_validation_simple_oox_input_passes(self):
     test_input = (self.a1, self.a2, Decimal('5'))
     test_result = (5, [{
         'account': self.a1,
         'value': 5
     }, {
         'account': self.a2,
         'value': -5
     }])
     self.assertEqual(Transaction.line_validation(test_input), test_result)
Ejemplo n.º 4
0
 def test_transaction_line_validation_multi_note1_passes(self):
     test_input = [("01-0101", 5, "A notation"), ("01-0102", -5)]
     test_result = [
         Decimal(5),
         [{
             'account': self.a1,
             'value': Decimal(5),
             'note': 'A notation'
         }, {
             'account': self.a2,
             'value': Decimal(-5)
         }]
     ]
     self.assertEqual(Transaction.line_validation(test_input), test_result)
Ejemplo n.º 5
0
 def test_transaction_line_validation_multi_same_passes(self):
     # have repeated same account is allowed in multi situation
     test_input = [("01-0101", -5), ("01-0101", -5), ("01-0101", 10)]
     test_result = [
         Decimal(10),
         [{
             'account': self.a1,
             'value': Decimal(-5)
         }, {
             'account': self.a1,
             'value': Decimal(-5)
         }, {
             'account': self.a1,
             'value': Decimal(10)
         }]
     ]
     self.assertEqual(Transaction.line_validation(test_input), test_result)