예제 #1
0
파일: test_till.py 프로젝트: rg3915/stoq
    def test_add_debit_entry(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        self.assertEqual(till.get_balance(), 0)
        till.add_debit_entry(10)
        self.assertEqual(till.get_balance(), -10)
예제 #2
0
    def testGetCashAmount(self):
        till = Till(store=self.store,
                    station=self.create_station())
        till.open_till()

        old = till.get_cash_amount()
        # money operations
        till.add_credit_entry(currency(10), u"")
        self.assertEqual(till.get_cash_amount(), old + 10)
        till.add_debit_entry(currency(5), u"")
        self.assertEqual(till.get_cash_amount(), old + 5)
        # non-money operations
        payment1 = self._create_inpayment()
        till.add_entry(payment1)
        self.assertEqual(till.get_cash_amount(), old + 5)
        payment2 = self._create_outpayment()
        till.add_entry(payment2)
        self.assertEqual(till.get_cash_amount(), old + 5)
        # money payment method operation
        payment = self.create_payment()
        payment.due_date = till.opening_date
        payment.till = till
        payment.set_pending()
        TillEntry(description=u'test', value=payment.value, till=till,
                  branch=till.station.branch, payment=payment, store=self.store)
        payment.pay()
        self.assertEqual(till.get_cash_amount(), old + 5 + payment.value)
예제 #3
0
    def test_add_debit_entry(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        self.assertEqual(till.get_balance(), 0)
        till.add_debit_entry(10)
        self.assertEqual(till.get_balance(), -10)
예제 #4
0
    def test_get_cash_amount(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        old = till.get_cash_amount()
        # money operations
        till.add_credit_entry(currency(10), u"")
        self.assertEqual(till.get_cash_amount(), old + 10)
        till.add_debit_entry(currency(5), u"")
        self.assertEqual(till.get_cash_amount(), old + 5)
        # non-money operations
        payment1 = self._create_inpayment()
        till.add_entry(payment1)
        self.assertEqual(till.get_cash_amount(), old + 5)
        payment2 = self._create_outpayment()
        till.add_entry(payment2)
        self.assertEqual(till.get_cash_amount(), old + 5)
        # money payment method operation
        payment = self.create_payment()
        payment.due_date = till.opening_date
        payment.set_pending()
        TillEntry(description=u'test',
                  value=payment.value,
                  till=till,
                  branch=till.station.branch,
                  payment=payment,
                  store=self.store)
        payment.pay()
        self.assertEqual(till.get_cash_amount(), old + 5 + payment.value)
예제 #5
0
    def test_get_balance(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        old = till.get_balance()
        till.add_credit_entry(currency(10), u"")
        self.assertEqual(till.get_balance(), old + 10)
        till.add_debit_entry(currency(5), u"")
        self.assertEqual(till.get_balance(), old + 5)
예제 #6
0
파일: test_till.py 프로젝트: rg3915/stoq
    def test_get_balance(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        old = till.get_balance()
        till.add_credit_entry(currency(10), u"")
        self.assertEqual(till.get_balance(), old + 10)
        till.add_debit_entry(currency(5), u"")
        self.assertEqual(till.get_balance(), old + 5)
예제 #7
0
 def test_till_close_more_than_balance(self):
     station = self.create_station()
     till = Till(store=self.store,
                 branch=self.current_branch,
                 station=station)
     till.open_till(self.current_user)
     till.add_debit_entry(currency(20), u"")
     with self.assertRaises(ValueError):
         till.close_till(self.current_user)
예제 #8
0
    def test_get_debits_total(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        old = till.get_debits_total()
        till.add_debit_entry(currency(10), u"")
        self.assertEqual(till.get_debits_total(), old - 10)
        # This should not affect the debit
        till.add_credit_entry(currency(5), u"")
        self.assertEqual(till.get_debits_total(), old - 10)
예제 #9
0
파일: test_till.py 프로젝트: rg3915/stoq
    def test_get_debits_total(self):
        till = Till(store=self.store, station=self.create_station())
        till.open_till()

        old = till.get_debits_total()
        till.add_debit_entry(currency(10), u"")
        self.assertEqual(till.get_debits_total(), old - 10)
        # This should not affect the debit
        till.add_credit_entry(currency(5), u"")
        self.assertEqual(till.get_debits_total(), old - 10)
예제 #10
0
 def testTillCloseMoreThanBalance(self):
     station = self.create_station()
     till = Till(store=self.store, station=station)
     till.open_till()
     till.add_debit_entry(currency(20), u"")
     self.assertRaises(ValueError, till.close_till)
예제 #11
0
파일: test_till.py 프로젝트: tmaxter/stoq
 def testTillCloseMoreThanBalance(self):
     station = self.create_station()
     till = Till(store=self.store, station=station)
     till.open_till()
     till.add_debit_entry(currency(20), u"")
     self.assertRaises(ValueError, till.close_till)