# Path: auto_forensicate/recipes/directory.py
# def FullPathToName(path):
#   def __init__(self, path, method='tar', compress=False):
#   def _GetSize(self):
#   def _GetStream(self):
#   def CloseStream(self):
#   def _GenerateCopyCommand(self):
#   def _GenerateTarCopyCommand(self):
#   def __init__(self, path, method='tar', compress=False):
#   def __init__(self, path, method='tar', compress=False):
#   def GetArtifacts(self):
# class DirectoryArtifact(base.BaseArtifact):
# class LinuxDirectoryArtifact(DirectoryArtifact):
# class MacDirectoryArtifact(DirectoryArtifact):
# class DirectoryRecipe(base.BaseRecipe):
#   _SUPPORTED_METHODS = ['tar']
#   _TAR_COMMAND = [
#       'tar', '-c', '-p', '--xattrs', '--acls', '--format=posix', '-f', '-']


import os
import subprocess
import tempfile
import unittest
from auto_forensicate.recipes import directory
    """Returns the size of an empty folder.

    This should match the current filesystem blocksize.
    """
    size = int(subprocess.check_output(['stat', '-fc', '%s', '.']).strip())
    return size

  def testInstantiate(self):
    with tempfile.TemporaryDirectory() as path:
      expected_name = path.replace(os.path.sep, '_')
      d = directory.DirectoryArtifact(path, method='tar', compress=False)
      self.assertEqual(d.path, path)
      self.assertEqual(d.name, expected_name)
      self.assertEqual(
          d.remote_path, 'Directories/{0:s}.tar'.format(expected_name))
      self.assertEqual(d.size, self._EmptyFolderSize())

      d = directory.DirectoryArtifact(path, method='tar', compress=True)
      self.assertEqual(
          d.remote_path, 'Directories/{0:s}.tar.gz'.format(expected_name))

  def testGenerateTarCopyCommand(self):
    with tempfile.TemporaryDirectory() as path:
      d = directory.DirectoryArtifact(path, method='tar', compress=False)
      command = d._TAR_COMMAND
      command.append(path)
      self.assertEqual(d._GenerateCopyCommand(), command)

  def testGenerateTarGzCopyCommand(self):
    with tempfile.TemporaryDirectory() as path:

# Path: auto_forensicate/recipes/directory.py
# def FullPathToName(path):
#   def __init__(self, path, method='tar', compress=False):
#   def _GetSize(self):
#   def _GetStream(self):
#   def CloseStream(self):
#   def _GenerateCopyCommand(self):
#   def _GenerateTarCopyCommand(self):
#   def __init__(self, path, method='tar', compress=False):
#   def __init__(self, path, method='tar', compress=False):
#   def GetArtifacts(self):
# class DirectoryArtifact(base.BaseArtifact):
# class LinuxDirectoryArtifact(DirectoryArtifact):
# class MacDirectoryArtifact(DirectoryArtifact):
# class DirectoryRecipe(base.BaseRecipe):
#   _SUPPORTED_METHODS = ['tar']
#   _TAR_COMMAND = [
#       'tar', '-c', '-p', '--xattrs', '--acls', '--format=posix', '-f', '-']


# Path: tests/directory_tests.py
import os
import subprocess
import tempfile
import unittest
from auto_forensicate.recipes import directory

    """Returns the size of an empty folder.

    This should match the current filesystem blocksize.
    """
    size = int(subprocess.check_output(['stat', '-fc', '%s', '.']).strip())
    return size

  def testInstantiate(self):
    with tempfile.TemporaryDirectory() as path:
      expected_name = path.replace(os.path.sep, '_')
      d = directory.DirectoryArtifact(path, method='tar', compress=False)
      self.assertEqual(d.path, path)
      self.assertEqual(d.name, expected_name)
      self.assertEqual(
          d.remote_path, 'Directories/{0:s}.tar'.format(expected_name))
      self.assertEqual(d.size, self._EmptyFolderSize())

      d = directory.DirectoryArtifact(path, method='tar', compress=True)
      self.assertEqual(
          d.remote_path, 'Directories/{0:s}.tar.gz'.format(expected_name))

  def testGenerateTarCopyCommand(self):
    with tempfile.TemporaryDirectory() as path:
      d = directory.DirectoryArtifact(path, method='tar', compress=False)
      command = d._TAR_COMMAND
      command.append(path)
      self.assertEqual(d._GenerateCopyCommand(), command)

  def testGenerateTarGzCopyCommand(self):
    with tempfile.TemporaryDirectory() as path:

      d = directory.DirectoryArtifact(path, method='tar', compress=True)