Changeset 13316 for main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
- Timestamp:
- 14 Oct 2015, 09:34:30 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/hostels/tests.py
r13315 r13316 35 35 from waeup.kofa.hostels.interfaces import ( 36 36 IHostelsContainer, IHostel, IBed) 37 from waeup.kofa.hostels.vocabularies import NOT_OCCUPIED 37 38 from waeup.kofa.hostels.container import HostelsContainer 38 39 from waeup.kofa.hostels.hostel import Hostel, Bed … … 173 174 clearSite() 174 175 shutil.rmtree(self.dc_root) 176 177 class HostelsContainerTests(HostelsFullSetup): 178 179 layer = FunctionalLayer 180 181 def test_release_expired_allocations(self): 182 cat = queryUtility(ICatalog, name='beds_catalog') 183 bedticket = BedTicket() 184 bedticket.booking_session = 2004 185 bedticket.bed_coordinates = u'anything' 186 self.student['accommodation'].addBedTicket(bedticket) 187 self.app[ 188 'hostels']['hall-x']['hall_block_room_bed'].owner = self.student_id 189 notify(grok.ObjectModifiedEvent( 190 self.app['hostels']['hall-x']['hall_block_room_bed'])) 191 results = cat.searchResults(owner=(self.student_id, self.student_id)) 192 self.assertEqual(len(results), 1) 193 released = self.app['hostels'].releaseExpiredAllocations(7) 194 self.assertEqual(released, 0) 195 delta = timedelta(days=10) 196 bedticket.booking_date = datetime.utcnow() - delta 197 released = self.app['hostels'].releaseExpiredAllocations(7) 198 self.assertEqual(released, 1) 199 results = cat.searchResults(owner=(self.student_id, self.student_id)) 200 self.assertEqual(len(results), 0) 201 self.assertMatches(bedticket.display_coordinates, 202 '-- booking expired (2015-10-14 08:35:38 UTC) --') 203 self.assertEqual( 204 self.app['hostels']['hall-x']['hall_block_room_bed'].owner, 205 NOT_OCCUPIED) 206 return 175 207 176 208 class BedCatalogTests(HostelsFullSetup): … … 330 362 self.assertMatches(bedticket.bed_coordinates, 331 363 u' -- booking cancelled on <YYYY-MM-DD hh:mm:ss> UTC --') 332 # The catalog wasupdated.364 # The catalog has been updated. 333 365 results = cat.searchResults(owner=(self.student_id, self.student_id)) 334 366 assert len(results) == 0
Note: See TracChangeset for help on using the changeset viewer.