'Tests resolving symlinks when getting stat entries.'

def testLinkStat(self):

    test_dir = os.path.join(self.temp_dir, 'lnk_stat_test')
    lnk = os.path.join(test_dir, 'lnk')
    lnk_target = os.path.join(test_dir, 'lnk_target')
    os.mkdir(test_dir)
    with open(lnk_target, 'wb') as fd:
        fd.write('sometext')
    os.symlink(lnk_target, lnk)
    paths = [lnk]
    link_size = os.lstat(lnk).st_size
    target_size = os.stat(lnk).st_size
    for (expected_size, resolve_links) in [(link_size, False), (target_size, True)]:
        stat_action = rdf_file_finder.FileFinderAction(action_type=rdf_file_finder.FileFinderAction.Action.STAT, stat=rdf_file_finder.FileFinderStatActionOptions(resolve_links=resolve_links))
        results = self._RunFileFinder(paths, stat_action)
        self.assertEqual(len(results), 1)
        res = results[0]
        self.assertEqual(res.stat_entry.st_size, expected_size)
