def testParseFileData(self): """Tests the _ParseFileData function.""" file_system_builder = fake_file_system_builder.FakeFileSystemBuilder() file_system_builder.AddFile(u'/etc/timezone', self._FILE_DATA) mount_point = fake_path_spec.FakePathSpec(location=u'/') plugin = linux.LinuxTimeZonePlugin() knowledge_base = self._RunPreprocessorPluginOnFileSystem( file_system_builder.file_system, mount_point, plugin) self.assertEqual(knowledge_base.timezone.zone, u'Europe/Zurich')
def testParseFileEntryWithTZif(self): """Tests the _ParseFileEntry function on a timezone information file.""" test_file_path = self._GetTestFilePath(['localtime.tzif']) self._SkipIfPathNotExists(test_file_path) file_system_builder = fake_file_system_builder.FakeFileSystemBuilder() file_system_builder.AddFileReadData('/etc/localtime', test_file_path) mount_point = fake_path_spec.FakePathSpec(location='/') plugin = linux.LinuxTimeZonePlugin() knowledge_base = self._RunPreprocessorPluginOnFileSystem( file_system_builder.file_system, mount_point, plugin) self.assertEqual(knowledge_base.timezone.zone, 'CET')