Changeset 6972 for main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Timestamp:
- 31 Oct 2011, 05:00:21 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/hostels
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py
r6970 r6972 23 23 from zope.testbrowser.testing import Browser 24 24 from zope.security.interfaces import Unauthorized 25 from zope.catalog.interfaces import ICatalog 26 from zope.component import queryUtility 25 27 from waeup.sirp.app import University 26 28 from waeup.sirp.hostels.interfaces import ( … … 90 92 setSite(app) 91 93 94 # Create a hostel 95 hostel = Hostel() 96 hostel.hostel_id = u'hall_x' 97 self.app['hostels'][hostel.hostel_id] = hostel 98 99 # Create a bed 100 bed = Bed() 101 bed.bed_id = u'xyz' 102 bed.bed_number = 1 103 bed.bed_type = u'abc' 104 self.app['hostels'][hostel.hostel_id][bed.bed_id] = bed 105 92 106 self.container_path = 'http://localhost/app/hostels' 93 107 self.manage_container_path = self.container_path + '/@@manage' … … 103 117 clearSite() 104 118 shutil.rmtree(self.dc_root) 119 120 class BedCatalogTests(HostelsFullSetup): 121 122 layer = FunctionalLayer 123 124 def test_get_catalog(self): 125 # We can get an students catalog if we wish 126 cat = queryUtility(ICatalog, name='beds_catalog') 127 assert cat is not None 128 129 def test_search_by_type(self): 130 # We can find a certain bed 131 cat = queryUtility(ICatalog, name='beds_catalog') 132 results = cat.searchResults(bed_type=('abc', 'abc')) 133 results = [x for x in results] # Turn results generator into list 134 assert len(results) == 1 135 assert results[0] is self.app['hostels']['hall_x']['xyz'] 105 136 106 137 class HostelsUITests(HostelsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.