Skip to content

Commit ee2837f

Browse files
committed
Add a few more very basic tests.
1 parent ab00245 commit ee2837f

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

tests/test_mig_shared_vgridaccess.py

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,39 @@ def test_load_vgrid_map(self):
236236
vgrid_map, map_stamp = load_vgrid_map(self.configuration)
237237
self.assertIn(self.test_vgrid, vgrid_map.get(VGRIDS, {}))
238238

239+
def test_check_vgrids_modified_initial(self):
240+
"""Verify initial state of modified vgrids list is empty"""
241+
modified, stamp = check_vgrids_modified(self.configuration)
242+
self.assertEqual(modified, ['ALL'])
243+
reset_vgrids_modified(self.configuration)
244+
modified, stamp = check_vgrids_modified(self.configuration)
245+
self.assertEqual(modified, [])
246+
247+
def test_resources_using_re_notfound(self):
248+
"""Test RE with no assigned resources returns empty list"""
249+
# Nonexistent RE should have no resources
250+
res_list = resources_using_re(self.configuration, 'NoSuchRE')
251+
self.assertEqual(res_list, [])
252+
253+
def test_vgrid_inherit_map_single(self):
254+
"""Test inheritance mapping with single vgrid"""
255+
test_settings = [('vgrid_name', self.test_vgrid),
256+
('hidden', True)]
257+
test_map = {
258+
VGRIDS: {
259+
self.test_vgrid: {
260+
SETTINGS: test_settings,
261+
OWNERS: [self.TEST_OWNER_DN]
262+
}
263+
}
264+
}
265+
inherited_map = vgrid_inherit_map(self.configuration, test_map)
266+
vgrid_data = inherited_map.get(VGRIDS, {})
267+
self.assertTrue(self.test_vgrid in vgrid_data)
268+
settings_dict = dict(vgrid_data[self.test_vgrid][SETTINGS])
269+
self.assertIs(type(settings_dict), dict)
270+
self.assertEqual(settings_dict.get('hidden'), True)
271+
239272
def test_check_vgrids_modified(self):
240273
"""Minimal test for vgrid modified tracking"""
241274
# Initially ALL marked modified until cache init
@@ -561,6 +594,35 @@ def test_unmap_vgrid(self):
561594
mod_list, mod_stamp = check_vgrids_modified(self.configuration)
562595
self.assertIn(self.test_vgrid, mod_list)
563596

597+
def test_check_vgrids_modified_initial(self):
598+
"""Verify initial state of modified vgrids list is empty"""
599+
modified, stamp = check_vgrids_modified(self.configuration)
600+
self.assertEqual(modified, ['ALL'])
601+
reset_vgrids_modified(self.configuration)
602+
modified, stamp = check_vgrids_modified(self.configuration)
603+
self.assertEqual(modified, [])
604+
605+
def test_resources_using_re_notfound(self):
606+
"""Test RE with no assigned resources returns empty list"""
607+
# Nonexistent RE should have no resources
608+
res_list = resources_using_re(self.configuration, 'NoSuchRE')
609+
self.assertEqual(res_list, [])
610+
611+
def test_vgrid_inherit_map_single(self):
612+
"""Test inheritance mapping with single vgrid"""
613+
test_settings = [('vgrid_name', self.test_vgrid),
614+
('description', 'Test description')]
615+
test_map = {
616+
VGRIDS: {
617+
self.test_vgrid: {
618+
SETTINGS: test_settings
619+
}
620+
}
621+
}
622+
inherited_map = vgrid_inherit_map(self.configuration, test_map)
623+
settings_dict = dict(inherited_map[VGRIDS][self.test_vgrid][SETTINGS])
624+
self.assertEqual(settings_dict['description'], 'Test description')
625+
564626
def test_access_nonexistent_vgrid(self):
565627
"""Ensure checks fail cleanly for non-existent vgrid"""
566628
allowed = check_vgrid_access(self.configuration, self.TEST_MEMBER_DN,

0 commit comments

Comments
 (0)