'Test our ability to list registry keys.'

def testRegistryListing(self):

    reg = rdf_paths.PathSpec.PathType.REGISTRY
    with vfs_test_lib.VFSOverrider(reg, vfs_test_lib.FakeRegistryVFSHandler):
        pathspec = rdf_paths.PathSpec(pathtype=rdf_paths.PathSpec.PathType.REGISTRY, path='/HKEY_USERS/S-1-5-20/Software/Microsoft/Windows/CurrentVersion/Run')
        expected_names = {'MctAdmin': stat.S_IFDIR, 'Sidebar': stat.S_IFDIR}
        expected_data = [u'%ProgramFiles%\\Windows    Sidebar\\Sidebar.exe    /autoRun', u'%TEMP%\\Sidebar.exe']
        for f in vfs.VFSOpen(pathspec).ListFiles():
            (base, name) = os.path.split(f.pathspec.CollapsePath())
            self.assertEqual(base, pathspec.CollapsePath())
            self.assertIn(name, expected_names)
            self.assertIn(f.registry_data.GetValue(), expected_data)
