# Path: dftimewolf/lib/utils.py
# TOKEN_REGEX = re.compile(r'\@([\w_]+)')
#   FORMAT = ''
#   FORMAT = 'html'
#   FORMAT = 'markdown'
# def Compress(source_path: str, output_directory: Optional[str]=None) -> str:
# def ImportArgsFromDict(value: Any,
#                        args: Dict[str,
#                        Any],
#                        config: Type[Config]) -> Any:
#   def IndentStart(self) -> str:
#   def IndentText(self, text: str, level: int=1) -> str:
#   def IndentEnd(self) -> str:
#   def BoldText(self, text: str) -> str:
#   def Link(self, url: str, text: str) -> str:
#   def ItalicText(self, text: str) -> str:
#   def UnderlineText(self, text: str) -> str:
#   def Line(self) -> str:
#   def Heading(self, text: str, level: int=1) -> str:
#   def Paragraph(self, text: str) -> str:
#   def IndentStart(self) -> str:
#   def IndentText(self, text: str, level: int=1) -> str:
#   def IndentEnd(self) -> str:
#   def BoldText(self, text: str) -> str:
#   def Link(self, url: str, text: str) -> str:
#   def ItalicText(self, text: str) -> str:
#   def UnderlineText(self, text: str) -> str:
#   def Line(self) -> str:
#   def Heading(self, text: str, level: int=1) -> str:
#   def Paragraph(self, text: str) -> str:
#   def IndentText(self, text: str, level: int=1) -> str:
#   def BoldText(self, text: str) -> str:
#   def Link(self, url: str, text: str) -> str:
#   def ItalicText(self, text: str) -> str:
#   def UnderlineText(self, text: str) -> str:
#   def Line(self) -> str:
#   def Heading(self, text: str, level: int=1) -> str:
#   def Paragraph(self, text: str) -> str:
#   def IndentStart(self) -> str:
#   def IndentEnd(self) -> str:
# class DFTimewolfFormatterClass(
#     argparse.ArgumentDefaultsHelpFormatter,
#     argparse.RawDescriptionHelpFormatter):
# class FormatterInterface(object):
# class HTMLFormatter(FormatterInterface):
# class MarkdownFormatter(FormatterInterface):


import os
import shutil
import tarfile
import tempfile
import unittest
import mock
from dftimewolf.lib import utils





class UtilsTest(unittest.TestCase):
  """Tests for the utils module."""

  def setUp(self):
    """Test setup."""
    self.tmp_input_dir = tempfile.mkdtemp(prefix='dftimewolf-input')
    self.tmp_output_dir = tempfile.mkdtemp(prefix='dftimewolf-output')

  def tearDown(self):
    """Tears Down class."""
    if 'dftimewolf-input' in self.tmp_input_dir:
      shutil.rmtree(self.tmp_input_dir)
    if 'dftimewolf-output' in self.tmp_output_dir:
      shutil.rmtree(self.tmp_output_dir)

  @mock.patch('tempfile.mkdtemp')
  def testCompress(self, mock_mkdtemp):
    """Tests the utils.Compress() method."""
    test_data = 'SampleInput'
    test_name = 'test_file.txt'
    mock_mkdtemp.return_value = self.tmp_output_dir
    test_file = os.path.join(self.tmp_input_dir, test_name)
    with open(test_file, 'w') as test_file_fh:
      test_file_fh.write(test_data)


# Path: dftimewolf/lib/utils.py
# TOKEN_REGEX = re.compile(r'\@([\w_]+)')
#   FORMAT = ''
#   FORMAT = 'html'
#   FORMAT = 'markdown'
# def Compress(source_path: str, output_directory: Optional[str]=None) -> str:
# def ImportArgsFromDict(value: Any,
#                        args: Dict[str,
#                        Any],
#                        config: Type[Config]) -> Any:
#   def IndentStart(self) -> str:
#   def IndentText(self, text: str, level: int=1) -> str:
#   def IndentEnd(self) -> str:
#   def BoldText(self, text: str) -> str:
#   def Link(self, url: str, text: str) -> str:
#   def ItalicText(self, text: str) -> str:
#   def UnderlineText(self, text: str) -> str:
#   def Line(self) -> str:
#   def Heading(self, text: str, level: int=1) -> str:
#   def Paragraph(self, text: str) -> str:
#   def IndentStart(self) -> str:
#   def IndentText(self, text: str, level: int=1) -> str:
#   def IndentEnd(self) -> str:
#   def BoldText(self, text: str) -> str:
#   def Link(self, url: str, text: str) -> str:
#   def ItalicText(self, text: str) -> str:
#   def UnderlineText(self, text: str) -> str:
#   def Line(self) -> str:
#   def Heading(self, text: str, level: int=1) -> str:
#   def Paragraph(self, text: str) -> str:
#   def IndentText(self, text: str, level: int=1) -> str:
#   def BoldText(self, text: str) -> str:
#   def Link(self, url: str, text: str) -> str:
#   def ItalicText(self, text: str) -> str:
#   def UnderlineText(self, text: str) -> str:
#   def Line(self) -> str:
#   def Heading(self, text: str, level: int=1) -> str:
#   def Paragraph(self, text: str) -> str:
#   def IndentStart(self) -> str:
#   def IndentEnd(self) -> str:
# class DFTimewolfFormatterClass(
#     argparse.ArgumentDefaultsHelpFormatter,
#     argparse.RawDescriptionHelpFormatter):
# class FormatterInterface(object):
# class HTMLFormatter(FormatterInterface):
# class MarkdownFormatter(FormatterInterface):


# Path: tests/lib/utils.py
import os
import shutil
import tarfile
import tempfile
import unittest
import mock
from dftimewolf.lib import utils






class UtilsTest(unittest.TestCase):
  """Tests for the utils module."""

  def setUp(self):
    """Test setup."""
    self.tmp_input_dir = tempfile.mkdtemp(prefix='dftimewolf-input')
    self.tmp_output_dir = tempfile.mkdtemp(prefix='dftimewolf-output')

  def tearDown(self):
    """Tears Down class."""
    if 'dftimewolf-input' in self.tmp_input_dir:
      shutil.rmtree(self.tmp_input_dir)
    if 'dftimewolf-output' in self.tmp_output_dir:
      shutil.rmtree(self.tmp_output_dir)

  @mock.patch('tempfile.mkdtemp')
  def testCompress(self, mock_mkdtemp):
    """Tests the utils.Compress() method."""
    test_data = 'SampleInput'
    test_name = 'test_file.txt'
    mock_mkdtemp.return_value = self.tmp_output_dir
    test_file = os.path.join(self.tmp_input_dir, test_name)
    with open(test_file, 'w') as test_file_fh:
      test_file_fh.write(test_data)


    output_file = utils.Compress(self.tmp_input_dir)