Index: /main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py	(revision 6984)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/hostels/tests.py	(revision 6985)
@@ -145,5 +145,5 @@
         return
 
-    def test_add_search_edit_delete_hostels(self):
+    def test_add_search_edit_delete_manage_hostels(self):
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
         self.browser.open(self.container_path)
@@ -157,5 +157,4 @@
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertTrue('Hostel created' in self.browser.contents)
-        #import pdb; pdb.set_trace()
         hall = self.app['hostels']['hall-1']
         hall.blocks_for_female = ['A','B']
@@ -165,7 +164,54 @@
         self.assertMatches(expected,self.browser.contents)
         self.browser.open(self.container_path + '/hall-1/manage')
-        self.browser.getControl(name="form.floors_per_block").value = '4'
+        self.browser.getControl(name="form.rooms_per_floor").value = '1'
         self.browser.getControl("Save").click()
         self.assertTrue('Form has been saved' in self.browser.contents)
+        # Since the testbrowser does not support Javascrip the
+        # save action cleared the settings above and we have to set them
+        # again
+        self.assertTrue(len(hall.blocks_for_female) == 0)
+        hall.blocks_for_female = ['A','B']
+        hall.beds_for_fresh = ['A','B']
+        hall.beds_for_all = ['D','E']
+        self.browser.getControl("Update all beds").click()
+        expected = '...0 empty beds removed, 8 beds added, 0 occupied beds modified...'
+        self.assertMatches(expected,self.browser.contents)
+        cat = queryUtility(ICatalog, name='beds_catalog')
+        results = cat.searchResults(
+            bed_type=('regular_female_all', 'regular_female_all'))
+        #import pdb; pdb.set_trace()
+        results = [x for x in results]
+        assert len(results) == 4
+        # Set bed reserved
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value='hall-1_A_101_D').selected = True
+        self.browser.getControl("Switch reservation", index=0).click()
+        self.assertTrue('Successfully switched beds: hall-1_A_101_D'
+            in self.browser.contents)
+        assert self.app[
+            'hostels'][
+            'hall-1'][
+            'hall-1_A_101_D'].bed_type == 'regular_female_reserved'
+        expected = 'name="form.beds_reserved.0." size="20" type="text" value="A_101_D"  />'
+        self.assertTrue(expected in self.browser.contents)
+        # Release bed
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value='hall-1_A_101_D').selected = True
+        self.browser.getControl("Switch reservation", index=0).click()
+        assert self.app[
+            'hostels'][
+            'hall-1'][
+            'hall-1_A_101_D'].bed_type == 'regular_female_all'
+        self.assertFalse(expected in self.browser.contents)
+        # Change hostel configuration
+        hall.beds_for_all = ['D']
+        self.browser.getControl("Update all beds").click()
+        expected = '...8 empty beds removed, 6 beds added, 0 occupied beds modified...'
+        self.assertMatches(expected,self.browser.contents)
+        results = cat.searchResults(
+            bed_type=('regular_female_all', 'regular_female_all'))
+        results = [x for x in results]
+        assert len(results) == 2
+        # Remove entire hostel
         self.browser.open(self.manage_container_path)
         ctrl = self.browser.getControl(name='val_id')
@@ -174,2 +220,7 @@
         self.browser.getControl("Remove selected", index=0).click()
         self.assertTrue('Successfully removed' in self.browser.contents)
+        # Catalog is empty
+        results = cat.searchResults(
+            bed_type=('regular_female_all', 'regular_female_all'))
+        results = [x for x in results]
+        assert len(results) == 0
