[POS-commit] r5399 - in stoqlib/trunk/stoqlib/domain: test

Johan Dahlin jdahlin at async.com.br
Wed Nov 29 15:10:12 BRST 2006


Author: jdahlin
Date: Wed Nov 29 15:10:11 2006
New Revision: 5399

Modified:
   stoqlib/trunk/stoqlib/domain/test/test_till.py
   stoqlib/trunk/stoqlib/domain/till.py

Log:
Raise an error when trying to open the till when it's already open

Modified: stoqlib/trunk/stoqlib/domain/test/test_till.py
==============================================================================
--- stoqlib/trunk/stoqlib/domain/test/test_till.py	(original)
+++ stoqlib/trunk/stoqlib/domain/test/test_till.py	Wed Nov 29 15:10:11 2006
@@ -25,6 +25,7 @@
 
 from kiwi.datatypes import currency
 
+from stoqlib.exceptions import StoqlibError
 from stoqlib.database.runtime import get_current_station
 from stoqlib.domain.station import BranchStation
 from stoqlib.domain.till import Till
@@ -42,6 +43,8 @@
         till.open_till()
         self.assertEqual(Till.get_current(self.trans), till)
 
+        self.assertRaises(StoqlibError, till.open_till)
+
     def testGetCurrentTillClose(self):
         station = get_current_station(self.trans)
 

Modified: stoqlib/trunk/stoqlib/domain/till.py
==============================================================================
--- stoqlib/trunk/stoqlib/domain/till.py	(original)
+++ stoqlib/trunk/stoqlib/domain/till.py	Wed Nov 29 15:10:11 2006
@@ -122,8 +122,7 @@
 
     def open_till(self):
         if self.status == Till.STATUS_OPEN:
-            # TODO: Raise an error
-            log.warning('till_open(): Till was already open')
+            raise StoqlibError('till_open(): Till was already open')
 
         conn = self.get_connection()
         last_till = get_last_till_operation_for_current_branch(conn)


More information about the POS-commit mailing list