コード例 #1
0
ファイル: test_till.py プロジェクト: sarkis89/stoq
 def test_needs_closing(self):
     till = Till(station=self.create_station(), store=self.store)
     self.failIf(till.needs_closing())
     till.open_till()
     self.failIf(till.needs_closing())
     till.opening_date = localnow() - datetime.timedelta(1)
     self.failUnless(till.needs_closing())
     till.close_till()
     self.failIf(till.needs_closing())
コード例 #2
0
ファイル: test_till.py プロジェクト: rg3915/stoq
 def test_needs_closing(self):
     till = Till(station=self.create_station(), store=self.store)
     self.failIf(till.needs_closing())
     till.open_till()
     self.failIf(till.needs_closing())
     till.opening_date = localnow() - datetime.timedelta(1)
     self.failUnless(till.needs_closing())
     till.close_till()
     self.failIf(till.needs_closing())
コード例 #3
0
    def test_till_open_previously_not_closed(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday
        till.close_till()
        till.closing_date = None

        self.assertRaises(TillError, till.open_till)
コード例 #4
0
ファイル: test_till.py プロジェクト: rg3915/stoq
    def test_till_open_previously_not_closed(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday
        till.close_till()
        till.closing_date = None

        self.assertRaises(TillError, till.open_till)
コード例 #5
0
ファイル: test_till.py プロジェクト: romaia/stoq
    def testTillOpenPreviouslyNotClosed(self):
        yesterday = datetime.datetime.today() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store),
                    store=self.store)
        till.open_till()
        till.opening_date = yesterday
        till.close_till()
        till.closing_date = None

        self.assertRaises(TillError, till.open_till)
コード例 #6
0
    def test_till_open_previously_not_closed(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(branch=self.current_branch,
                    station=self.current_station,
                    store=self.store)
        till.open_till(self.current_user)
        till.opening_date = yesterday
        till.close_till(self.current_user)
        till.closing_date = None

        with self.assertRaises(TillError):
            till.open_till(self.current_user)
コード例 #7
0
    def test_till_open_yesterday(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday

        self.assertRaises(TillError, Till.get_current, self.store)
        # This is used to close a till
        self.assertEqual(Till.get_last_opened(self.store), till)

        till.close_till()

        self.assertEqual(Till.get_current(self.store), None)
コード例 #8
0
ファイル: test_till.py プロジェクト: rg3915/stoq
    def test_till_open_previously_opened(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday
        till.add_credit_entry(currency(10), u"")
        till.close_till()
        till.closing_date = yesterday

        new_till = Till(station=get_current_station(self.store), store=self.store)
        self.failUnless(new_till._get_last_closed_till())
        new_till.open_till()
        self.assertEquals(new_till.initial_cash_amount, till.final_cash_amount)
コード例 #9
0
ファイル: test_till.py プロジェクト: rg3915/stoq
    def test_till_open_yesterday(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday

        self.assertRaises(TillError, Till.get_current, self.store)
        # This is used to close a till
        self.assertEqual(Till.get_last_opened(self.store), till)

        till.close_till()

        self.assertEqual(Till.get_current(self.store), None)
コード例 #10
0
    def test_till_open_previously_opened(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(station=get_current_station(self.store), store=self.store)
        till.open_till()
        till.opening_date = yesterday
        till.add_credit_entry(currency(10), u"")
        till.close_till()
        till.closing_date = yesterday

        new_till = Till(station=get_current_station(self.store),
                        store=self.store)
        self.assertTrue(new_till._get_last_closed_till())
        new_till.open_till()
        self.assertEqual(new_till.initial_cash_amount, till.final_cash_amount)
コード例 #11
0
    def test_needs_closing(self):
        till = Till(station=self.create_station(), store=self.store)
        self.assertFalse(till.needs_closing())

        # Till is opened today, no need to close
        till.open_till()
        self.assertFalse(till.needs_closing())

        # till was onpened yesterday. Should close
        till.opening_date = localnow() - datetime.timedelta(1)
        self.assertTrue(till.needs_closing())

        # Till was opened yesterday, but there is a tolerance
        tolerance = int((localnow() - localtoday()).seconds / (60 * 60)) + 1
        with self.sysparam(TILL_TOLERANCE_FOR_CLOSING=tolerance):
            self.assertFalse(till.needs_closing())

        # Till is now closed, no need to close again
        till.close_till()
        self.assertFalse(till.needs_closing())
コード例 #12
0
    def test_till_open_yesterday(self):
        yesterday = localnow() - datetime.timedelta(1)

        # Open a till, set the opening_date to yesterday
        till = Till(branch=self.current_branch,
                    station=self.current_station,
                    store=self.store)
        till.open_till(self.current_user)
        till.opening_date = yesterday

        with self.assertRaises(TillError):
            Till.get_current(self.store, self.current_station)
        # This is used to close a till
        self.assertEqual(
            Till.get_last_opened(self.store, self.current_station), till)

        till.close_till(self.current_user)

        self.assertEqual(Till.get_current(self.store, self.current_station),
                         None)
コード例 #13
0
ファイル: test_payment_method.py プロジェクト: romaia/stoq
 def _createUnclosedTill(self):
     till = Till(station=get_current_station(self.store),
                 store=self.store)
     till.open_till()
     yesterday = datetime.date.today() - datetime.timedelta(1)
     till.opening_date = yesterday
コード例 #14
0
 def _createUnclosedTill(self):
     till = Till(station=get_current_station(self.store), store=self.store)
     till.open_till()
     yesterday = localtoday() - datetime.timedelta(1)
     till.opening_date = yesterday