# Path: dtformats/utmp.py
# class LinuxLibc6UtmpFile(data_format.BinaryDataFile):
# class MacOSXUtmpxFile(data_format.BinaryDataFile):
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile('utmp.yaml')
#   _EMPTY_IP_ADDRESS = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
#   _TYPES_OF_LOGIN = {
#       0: 'EMPTY',
#       1: 'RUN_LVL',
#       2: 'BOOT_TIME',
#       3: 'NEW_TIME',
#       4: 'OLD_TIME',
#       5: 'INIT_PROCESS',
#       6: 'LOGIN_PROCESS',
#       7: 'USER_PROCESS',
#       8: 'DEAD_PROCESS',
#       9: 'ACCOUNTING'}
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile('utmp.yaml')
#   _TYPES_OF_LOGIN = {
#       0: 'EMPTY',
#       1: 'RUN_LVL',
#       2: 'BOOT_TIME',
#       3: 'OLD_TIME',
#       4: 'NEW_TIME',
#       5: 'INIT_PROCESS',
#       6: 'LOGIN_PROCESS',
#       7: 'USER_PROCESS',
#       8: 'DEAD_PROCESS',
#       9: 'ACCOUNTING',
#       10: 'SIGNATURE',
#       11: 'SHUTDOWN_TIME'}
#   def _DebugPrintEntry(self, entry):
#   def _DecodeString(self, byte_stream, encoding='utf8'):
#   def _ReadEntries(self, file_object):
#   def ReadFileObject(self, file_object):
#   def _DebugPrintEntry(self, entry):
#   def _DecodeString(self, byte_stream, encoding='utf8'):
#   def _ReadEntries(self, file_object):
#   def ReadFileObject(self, file_object):
# 
# Path: tests/test_lib.py
# class BaseTestCase(unittest.TestCase):
# class TestOutputWriter(output_writers.OutputWriter):
#   _TEST_DATA_PATH = os.path.join(os.getcwd(), 'test_data')
#   def _GetTestFilePath(self, path_segments):
#   def _SkipIfPathNotExists(self, path):
#   def __init__(self):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):


import unittest
from dtformats import utmp
from tests import test_lib

    data_type_map = test_file._GetDataTypeMap('linux_libc6_utmp_entry')

    entry = data_type_map.CreateStructureValues(
        ip_address=test_file._EMPTY_IP_ADDRESS,
        exit_status=5,
        hostname=b'host',
        microseconds=8,
        pid=2,
        session=6,
        terminal=b'vty',
        terminal_identifier=3,
        termination_status=4,
        timestamp=7,
        type=1,
        unknown1=b'unknown',
        username=b'user')

    test_file._DebugPrintEntry(entry)

  def testDecodeString(self):
    """Tests the _DecodeString function."""
    test_file = utmp.LinuxLibc6UtmpFile()

    string = test_file._DecodeString(b'test\x00')
    self.assertEqual(string, 'test')

  def testReadEntries(self):
    """Tests the _ReadEntries function."""
    output_writer = test_lib.TestOutputWriter()

# Path: dtformats/utmp.py
# class LinuxLibc6UtmpFile(data_format.BinaryDataFile):
# class MacOSXUtmpxFile(data_format.BinaryDataFile):
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile('utmp.yaml')
#   _EMPTY_IP_ADDRESS = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
#   _TYPES_OF_LOGIN = {
#       0: 'EMPTY',
#       1: 'RUN_LVL',
#       2: 'BOOT_TIME',
#       3: 'NEW_TIME',
#       4: 'OLD_TIME',
#       5: 'INIT_PROCESS',
#       6: 'LOGIN_PROCESS',
#       7: 'USER_PROCESS',
#       8: 'DEAD_PROCESS',
#       9: 'ACCOUNTING'}
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile('utmp.yaml')
#   _TYPES_OF_LOGIN = {
#       0: 'EMPTY',
#       1: 'RUN_LVL',
#       2: 'BOOT_TIME',
#       3: 'OLD_TIME',
#       4: 'NEW_TIME',
#       5: 'INIT_PROCESS',
#       6: 'LOGIN_PROCESS',
#       7: 'USER_PROCESS',
#       8: 'DEAD_PROCESS',
#       9: 'ACCOUNTING',
#       10: 'SIGNATURE',
#       11: 'SHUTDOWN_TIME'}
#   def _DebugPrintEntry(self, entry):
#   def _DecodeString(self, byte_stream, encoding='utf8'):
#   def _ReadEntries(self, file_object):
#   def ReadFileObject(self, file_object):
#   def _DebugPrintEntry(self, entry):
#   def _DecodeString(self, byte_stream, encoding='utf8'):
#   def _ReadEntries(self, file_object):
#   def ReadFileObject(self, file_object):
# 
# Path: tests/test_lib.py
# class BaseTestCase(unittest.TestCase):
# class TestOutputWriter(output_writers.OutputWriter):
#   _TEST_DATA_PATH = os.path.join(os.getcwd(), 'test_data')
#   def _GetTestFilePath(self, path_segments):
#   def _SkipIfPathNotExists(self, path):
#   def __init__(self):
#   def Close(self):
#   def Open(self):
#   def WriteText(self, text):


# Path: tests/utmp.py
import unittest
from dtformats import utmp
from tests import test_lib


    data_type_map = test_file._GetDataTypeMap('linux_libc6_utmp_entry')

    entry = data_type_map.CreateStructureValues(
        ip_address=test_file._EMPTY_IP_ADDRESS,
        exit_status=5,
        hostname=b'host',
        microseconds=8,
        pid=2,
        session=6,
        terminal=b'vty',
        terminal_identifier=3,
        termination_status=4,
        timestamp=7,
        type=1,
        unknown1=b'unknown',
        username=b'user')

    test_file._DebugPrintEntry(entry)

  def testDecodeString(self):
    """Tests the _DecodeString function."""
    test_file = utmp.LinuxLibc6UtmpFile()

    string = test_file._DecodeString(b'test\x00')
    self.assertEqual(string, 'test')

  def testReadEntries(self):
    """Tests the _ReadEntries function."""
    output_writer = test_lib.TestOutputWriter()

    test_file = utmp.LinuxLibc6UtmpFile(output_writer=output_writer)