Exemplo n.º 1
0
    def testMatch(self):
        """Tests the Match function."""
        path_filter = interface.WindowsRegistryKeyPathSuffixFilter(
            'Windows\\Explorer')

        registry_key = dfwinreg_fake.FakeWinRegistryKey(
            'Explorer',
            key_path='HKEY_LOCAL_MACHINE\\Software\\Windows\\Explorer')

        result = path_filter.Match(registry_key)
        self.assertTrue(result)

        registry_key = dfwinreg_fake.FakeWinRegistryKey(
            'Windows', key_path='HKEY_LOCAL_MACHINE\\Software\\Windows')

        result = path_filter.Match(registry_key)
        self.assertFalse(result)

        key_path = 'HKEY_LOCAL_MACHINE\\Software\\Windows\\Explorer\\Zones'
        registry_key = dfwinreg_fake.FakeWinRegistryKey('Explorer',
                                                        key_path=key_path)

        result = path_filter.Match(registry_key)
        self.assertFalse(result)
Exemplo n.º 2
0
 def testKeyPaths(self):
     """Tests the key_paths property."""
     path_filter = interface.WindowsRegistryKeyPathSuffixFilter(
         'Windows\\Explorer')
     self.assertEqual(path_filter.key_paths, [])
Exemplo n.º 3
0
 def testInitialize(self):
     """Tests the __init__ function."""
     path_filter = interface.WindowsRegistryKeyPathSuffixFilter(
         'Windows\\Explorer')
     self.assertIsNotNone(path_filter)