Changeset 7003 for main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Timestamp:
- 4 Nov 2011, 21:26:33 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/hostel.py
r6998 r7003 18 18 """ 19 19 import grok 20 from zope.event import notify 20 21 from datetime import datetime 21 22 from grok import index … … 130 131 if self.owner == NOT_OCCUPIED: 131 132 self.owner = student_id 133 notify(grok.ObjectModifiedEvent(self)) 132 134 return None 133 135 else: … … 135 137 136 138 def switchReservation(self): 137 """Reserves a bedor unreserve bed respectively.139 """Reserves or unreserve bed respectively. 138 140 """ 139 141 sh, sex, bt = self.bed_type.split('_') -
main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py
r6988 r7003 19 19 import shutil 20 20 import tempfile 21 import grok 22 from zope.event import notify 23 21 24 from zope.interface.verify import verifyClass, verifyObject 22 25 from zope.component.hooks import setSite, clearSite … … 130 133 # We can find a certain bed 131 134 cat = queryUtility(ICatalog, name='beds_catalog') 132 results = cat.searchResults(bed_type=('abc', 'abc')) 135 results = cat.searchResults(bed_type=(u'abc', u'abc')) 136 results = [x for x in results] # Turn results generator into list 137 assert len(results) == 1 138 assert results[0] is self.app['hostels']['hall-x']['xyz'] 139 140 def test_search_by_owner(self): 141 # We can find a certain bed 142 myobj = self.app['hostels']['hall-x']['xyz'] 143 myobj.owner = u'abc' 144 notify(grok.ObjectModifiedEvent(myobj)) 145 cat = queryUtility(ICatalog, name='beds_catalog') 146 results = cat.searchResults(owner=(u'abc', u'abc')) 133 147 results = [x for x in results] # Turn results generator into list 134 148 assert len(results) == 1
Note: See TracChangeset for help on using the changeset viewer.