|
36 | 36 | USERID, VGRIDS, check_vgrid_access, check_vgrids_modified, \ |
37 | 37 | force_update_resource_map, force_update_user_map, force_update_vgrid_map, \ |
38 | 38 | get_re_provider_map, get_resource_map, get_user_map, get_vgrid_map, \ |
39 | | - load_resource_map, mark_vgrid_modified, refresh_resource_map, \ |
40 | | - refresh_user_map, refresh_vgrid_map, res_vgrid_access, \ |
41 | | - reset_vgrids_modified, resources_using_re, unmap_vgrid, user_vgrid_access, \ |
42 | | - vgrid_inherit_map |
| 39 | + load_resource_map, load_user_map, load_vgrid_map, mark_vgrid_modified, \ |
| 40 | + refresh_resource_map, refresh_user_map, refresh_vgrid_map, \ |
| 41 | + res_vgrid_access, reset_vgrids_modified, resources_using_re, unmap_vgrid, \ |
| 42 | + user_vgrid_access, vgrid_inherit_map |
43 | 43 | from tests.support import MigTestCase, ensure_dirs_exist, testmain |
44 | 44 |
|
45 | 45 |
|
@@ -107,7 +107,8 @@ def _create_resource(self, res_name, owners, config=None): |
107 | 107 | saved = pickle(owners, res_owners_path, self.logger) |
108 | 108 | self.assertTrue(saved) |
109 | 109 | if config is None: |
110 | | - config = {} |
| 110 | + # Make sure conf has one valid field |
| 111 | + config = {'HOSTURL': res_name} |
111 | 112 | saved = pickle(config, res_config_path, self.logger) |
112 | 113 | self.assertTrue(saved) |
113 | 114 |
|
@@ -200,6 +201,41 @@ def test_get_vgrid_map(self): |
200 | 201 | self.assertTrue(vgrid_map) |
201 | 202 | self.assertIn(self.test_vgrid, vgrid_map.get(VGRIDS, [])) |
202 | 203 |
|
| 204 | + def test_load_user_map(self): |
| 205 | + """Basic test for direct user map loading""" |
| 206 | + # Get empty map initially |
| 207 | + user_map, map_stamp = load_user_map(self.configuration) |
| 208 | + self.assertEqual(user_map, {}) |
| 209 | + # Add test user |
| 210 | + self._provision_test_user(self, self.TEST_USER_DN) |
| 211 | + force_update_user_map(self.configuration) |
| 212 | + # Verify updated map contains user |
| 213 | + updated_map, updated_stamp = load_user_map(self.configuration) |
| 214 | + self.assertIn(self.TEST_USER_DN, updated_map) |
| 215 | + |
| 216 | + def test_load_resource_map(self): |
| 217 | + """Basic test for direct resource map loading""" |
| 218 | + # Get empty map initially |
| 219 | + res_map, map_stamp = load_resource_map(self.configuration) |
| 220 | + self.assertEqual(res_map, {}) |
| 221 | + # Add test resource |
| 222 | + self._create_resource(self.TEST_RESOURCE_ID, [self.TEST_OWNER_DN]) |
| 223 | + force_update_resource_map(self.configuration) |
| 224 | + # Verify updated map contains resource after refresh |
| 225 | + res_map, map_stamp = load_resource_map(self.configuration) |
| 226 | + self.assertIn(self.TEST_RESOURCE_ID, res_map) |
| 227 | + |
| 228 | + def test_load_vgrid_map(self): |
| 229 | + """Basic test for direct vgrid map loading""" |
| 230 | + # Get map with at least 'Generic' vgrid |
| 231 | + vgrid_map, map_stamp = load_vgrid_map(self.configuration) |
| 232 | + self.assertIn('Generic', vgrid_map.get(VGRIDS, {})) |
| 233 | + self._create_vgrid(self.test_vgrid, [self.TEST_OWNER_DN]) |
| 234 | + force_update_vgrid_map(self.configuration) |
| 235 | + # Verify updated map contains vgrid after refresh |
| 236 | + vgrid_map, map_stamp = load_vgrid_map(self.configuration) |
| 237 | + self.assertIn(self.test_vgrid, vgrid_map.get(VGRIDS, {})) |
| 238 | + |
203 | 239 | def test_check_vgrids_modified(self): |
204 | 240 | """Minimal test for vgrid modified tracking""" |
205 | 241 | # Initially ALL marked modified until cache init |
|
0 commit comments