Skip to content

Commit

Permalink
Added test for registry.GetRootKey #121 (#223)
Browse files Browse the repository at this point in the history
  • Loading branch information
joachimmetz authored Feb 27, 2024
1 parent d19932b commit 62c37ca
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tests/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,29 @@ def testGetRegistryFileMappingOnSystem(self):

# TODO: add GetRegistryFileMapping on UsrClass file test.

# TODO: add tests for GetRootKey
def testGetRootKey(self):
"""Tests the GetRootKey function."""
test_path = self._GetTestFilePath(['SYSTEM'])
self._SkipIfPathNotExists(test_path)

win_registry = registry.WinRegistry(
registry_file_reader=TestREGFWinRegistryFileReader())
win_registry.OpenAndMapFile(test_path)

root_key = win_registry.GetRootKey()
self.assertIsNotNone(root_key)

expected_subkey_names = [
'HKEY_CLASSES_ROOT',
'HKEY_CURRENT_CONFIG',
'HKEY_CURRENT_USER',
'HKEY_DYN_DATA',
'HKEY_LOCAL_MACHINE',
'HKEY_PERFORMANCE_DATA',
'HKEY_USERS']

subkey_names = sorted([subkey.name for subkey in root_key.GetSubkeys()])
self.assertEqual(subkey_names, expected_subkey_names)

def testMapFile(self):
"""Tests the MapFile function."""
Expand Down

0 comments on commit 62c37ca

Please sign in to comment.