# Path: dtformats/job.py
# class WindowsTaskSchedularJobFile(data_format.BinaryDataFile):
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile('job.yaml')
#   _DEBUG_INFO_FIXED_LENGTH_DATA_SECTION = [
#       ('signature', 'Signature', '_FormatIntegerAsProductVersion'),
#       ('format_version', 'Format version', '_FormatIntegerAsDecimal'),
#       ('job_identifier', 'Job identifier', '_FormatUUIDAsString'),
#       ('application_name_offset', 'Application name offset',
#        '_FormatIntegerAsHexadecimal4'),
#       ('triggers_offset', 'Triggers offset', '_FormatIntegerAsHexadecimal4'),
#       ('error_retry_count', 'Error retry count', '_FormatIntegerAsDecimal'),
#       ('error_retry_interval', 'Error retry interval',
#        '_FormatIntegerAsIntervalInMinutes'),
#       ('idle_deadline', 'Idle deadline', '_FormatIntegerAsIntervalInMinutes'),
#       ('idle_wait', 'Idle wait', '_FormatIntegerAsIntervalInMinutes'),
#       ('priority', 'Priority', '_FormatIntegerAsHexadecimal8'),
#       ('maximum_run_time', 'Maximum run time',
#        '_FormatIntegerAsIntervalInMilliseconds'),
#       ('exit_code', 'Exit code', '_FormatIntegerAsHexadecimal8'),
#       ('status', 'Status', '_FormatIntegerAsHexadecimal8'),
#       ('flags', 'Flags', '_FormatIntegerAsHexadecimal8'),
#       ('last_run_time', 'Last run time', '_FormatSystemTime')]
#   _DEBUG_INFO_TRIGGER = [
#       ('size', 'Size', '_FormatIntegerAsDecimal'),
#       ('reserved1', 'Reserved1', '_FormatIntegerAsHexadecimal4'),
#       ('start_date', 'Start date', '_FormatDate'),
#       ('end_date', 'End date', '_FormatDate'),
#       ('start_time', 'Start time', '_FormatTime'),
#       ('duration', 'Duration', '_FormatIntegerAsIntervalInMinutes'),
#       ('interval', 'Interval', '_FormatIntegerAsIntervalInMinutes'),
#       ('trigger_flags', 'Trigger flags', '_FormatIntegerAsHexadecimal8'),
#       ('trigger_type', 'Trigger type', '_FormatIntegerAsHexadecimal8'),
#       ('trigger_arg0', 'Trigger arg0', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_arg1', 'Trigger arg1', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_arg2', 'Trigger arg2', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_padding', 'Trigger padding', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_reserved2', 'Trigger reserved2',
#        '_FormatIntegerAsHexadecimal4'),
#       ('trigger_reserved3', 'Trigger reserved3',
#        '_FormatIntegerAsHexadecimal4')]
#   _DEBUG_INFO_VARIABLE_LENGTH_DATA_SECTION = [
#       ('running_instance_count', 'Running instance count',
#        '_FormatIntegerAsDecimal'),
#       ('application_name', 'Application name', '_FormatString'),
#       ('parameters', 'Parameters', '_FormatString'),
#       ('working_directory', 'Working directory', '_FormatString'),
#       ('author', 'Author', '_FormatString'),
#       ('comment', 'Comment', '_FormatString'),
#       ('user_data', 'User data', '_FormatDataStream'),
#       ('reserved_data', 'Reserved data', '_FormatDataStream'),
#       ('number_of_triggers', 'Number of triggers', '_FormatIntegerAsDecimal')]
#   def _FormatDataStream(self, data_stream):
#   def _FormatDate(self, date):
#   def _FormatIntegerAsIntervalInMilliseconds(self, integer):
#   def _FormatIntegerAsIntervalInMinutes(self, integer):
#   def _FormatIntegerAsProductVersion(self, integer):
#   def _FormatString(self, string):
#   def _FormatSystemTime(self, systemtime):
#   def _FormatTime(self, time):
#   def _ReadFixedLengthDataSection(self, file_object):
#   def _ReadVariableLengthDataSection(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 os
import unittest
from dtformats import job
from tests import test_lib


class WindowsTaskSchedularJobFileTest(test_lib.BaseTestCase):
  """Windows Task Scheduler job file tests."""

  # pylint: disable=protected-access

  # TODO: add test for _FormatDataStream
  # TODO: add test for _FormatDate
  # TODO: add test for _FormatIntegerAsIntervalInMilliseconds
  # TODO: add test for _FormatIntegerAsIntervalInMinutes
  # TODO: add test for _FormatIntegerAsProductVersion
  # TODO: add test for _FormatString
  # TODO: add test for _FormatSystemTime
  # TODO: add test for _FormatTime

  def testReadFixedLengthDataSection(self):
    """Tests the _ReadFixedLengthDataSection function."""
    output_writer = test_lib.TestOutputWriter()
    test_file = job.WindowsTaskSchedularJobFile(
        output_writer=output_writer)

    test_file_path = self._GetTestFilePath(['wintask.job'])
    self._SkipIfPathNotExists(test_file_path)

    with open(test_file_path, 'rb') as file_object:
      test_file._ReadFixedLengthDataSection(file_object)

  def testReadVariableLengthDataSection(self):
    """Tests the _ReadVariableLengthDataSection function."""

# Path: dtformats/job.py
# class WindowsTaskSchedularJobFile(data_format.BinaryDataFile):
#   _FABRIC = data_format.BinaryDataFile.ReadDefinitionFile('job.yaml')
#   _DEBUG_INFO_FIXED_LENGTH_DATA_SECTION = [
#       ('signature', 'Signature', '_FormatIntegerAsProductVersion'),
#       ('format_version', 'Format version', '_FormatIntegerAsDecimal'),
#       ('job_identifier', 'Job identifier', '_FormatUUIDAsString'),
#       ('application_name_offset', 'Application name offset',
#        '_FormatIntegerAsHexadecimal4'),
#       ('triggers_offset', 'Triggers offset', '_FormatIntegerAsHexadecimal4'),
#       ('error_retry_count', 'Error retry count', '_FormatIntegerAsDecimal'),
#       ('error_retry_interval', 'Error retry interval',
#        '_FormatIntegerAsIntervalInMinutes'),
#       ('idle_deadline', 'Idle deadline', '_FormatIntegerAsIntervalInMinutes'),
#       ('idle_wait', 'Idle wait', '_FormatIntegerAsIntervalInMinutes'),
#       ('priority', 'Priority', '_FormatIntegerAsHexadecimal8'),
#       ('maximum_run_time', 'Maximum run time',
#        '_FormatIntegerAsIntervalInMilliseconds'),
#       ('exit_code', 'Exit code', '_FormatIntegerAsHexadecimal8'),
#       ('status', 'Status', '_FormatIntegerAsHexadecimal8'),
#       ('flags', 'Flags', '_FormatIntegerAsHexadecimal8'),
#       ('last_run_time', 'Last run time', '_FormatSystemTime')]
#   _DEBUG_INFO_TRIGGER = [
#       ('size', 'Size', '_FormatIntegerAsDecimal'),
#       ('reserved1', 'Reserved1', '_FormatIntegerAsHexadecimal4'),
#       ('start_date', 'Start date', '_FormatDate'),
#       ('end_date', 'End date', '_FormatDate'),
#       ('start_time', 'Start time', '_FormatTime'),
#       ('duration', 'Duration', '_FormatIntegerAsIntervalInMinutes'),
#       ('interval', 'Interval', '_FormatIntegerAsIntervalInMinutes'),
#       ('trigger_flags', 'Trigger flags', '_FormatIntegerAsHexadecimal8'),
#       ('trigger_type', 'Trigger type', '_FormatIntegerAsHexadecimal8'),
#       ('trigger_arg0', 'Trigger arg0', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_arg1', 'Trigger arg1', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_arg2', 'Trigger arg2', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_padding', 'Trigger padding', '_FormatIntegerAsHexadecimal4'),
#       ('trigger_reserved2', 'Trigger reserved2',
#        '_FormatIntegerAsHexadecimal4'),
#       ('trigger_reserved3', 'Trigger reserved3',
#        '_FormatIntegerAsHexadecimal4')]
#   _DEBUG_INFO_VARIABLE_LENGTH_DATA_SECTION = [
#       ('running_instance_count', 'Running instance count',
#        '_FormatIntegerAsDecimal'),
#       ('application_name', 'Application name', '_FormatString'),
#       ('parameters', 'Parameters', '_FormatString'),
#       ('working_directory', 'Working directory', '_FormatString'),
#       ('author', 'Author', '_FormatString'),
#       ('comment', 'Comment', '_FormatString'),
#       ('user_data', 'User data', '_FormatDataStream'),
#       ('reserved_data', 'Reserved data', '_FormatDataStream'),
#       ('number_of_triggers', 'Number of triggers', '_FormatIntegerAsDecimal')]
#   def _FormatDataStream(self, data_stream):
#   def _FormatDate(self, date):
#   def _FormatIntegerAsIntervalInMilliseconds(self, integer):
#   def _FormatIntegerAsIntervalInMinutes(self, integer):
#   def _FormatIntegerAsProductVersion(self, integer):
#   def _FormatString(self, string):
#   def _FormatSystemTime(self, systemtime):
#   def _FormatTime(self, time):
#   def _ReadFixedLengthDataSection(self, file_object):
#   def _ReadVariableLengthDataSection(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/job.py
import os
import unittest
from dtformats import job
from tests import test_lib



class WindowsTaskSchedularJobFileTest(test_lib.BaseTestCase):
  """Windows Task Scheduler job file tests."""

  # pylint: disable=protected-access

  # TODO: add test for _FormatDataStream
  # TODO: add test for _FormatDate
  # TODO: add test for _FormatIntegerAsIntervalInMilliseconds
  # TODO: add test for _FormatIntegerAsIntervalInMinutes
  # TODO: add test for _FormatIntegerAsProductVersion
  # TODO: add test for _FormatString
  # TODO: add test for _FormatSystemTime
  # TODO: add test for _FormatTime

  def testReadFixedLengthDataSection(self):
    """Tests the _ReadFixedLengthDataSection function."""
    output_writer = test_lib.TestOutputWriter()
    test_file = job.WindowsTaskSchedularJobFile(
        output_writer=output_writer)

    test_file_path = self._GetTestFilePath(['wintask.job'])
    self._SkipIfPathNotExists(test_file_path)

    with open(test_file_path, 'rb') as file_object:
      test_file._ReadFixedLengthDataSection(file_object)

  def testReadVariableLengthDataSection(self):
    """Tests the _ReadVariableLengthDataSection function."""

    output_writer = test_lib.TestOutputWriter()