# Path: auto_forensicate/auto_acquire.py
# VALID_RECIPES = {
#     'directory': directory.DirectoryRecipe,
#     'disk': disk.DiskRecipe,
#     'firmware': firmware.ChipsecRecipe,
#     'sysinfo': sysinfo.SysinfoRecipe
# }
# DEFAULT_RECIPES = frozenset({'disk', 'firmware', 'sysinfo'})
# ARTIFACT_MIN_REPORTING_SIZE = 1024**3
# def HumanReadableBytes(byte_val, prefix='dec'):
#   def update_with_total(self, _unused_current_bytes, _unused_total_bytes):
#   def _Update(self, current_bytes):
#   def speed(self):
#   def update_with_total(self, current_bytes, _unused_total_bytes):
#   def __init__(self, artifact, progress_logger, reporting_frequency=5):
#   def _CheckReportable(self, percentage):
#   def update_with_total(self, current_bytes, _unused_total_bytes):
#   def __init__(self):
#   def RegisterCallback(self, callback):
#   def update_with_total(self, current_bytes, total_bytes):
#   def __init__(self, recipes=None):
#   def _CreateParser(self):
#   def _ParseLoggingArguments(self, options):
#   def _MakeUploader(self, options):
#   def ParseArguments(self, args):
#   def _ParseRecipes(self, options):
#   def _ParseGCSJSON(self, options):
#   def _MakeProgressBar(self, max_size, name, message=None):
#   def _MakeGCPProgressReporter(self, artifact):
#   def Do(self, recipe):
#   def _UploadArtifact(self, artifact, update_callback=None):
#   def _UploadArtifacts(self, artifacts):
#   def _Colorize(self, color, msg):
#   def Main(self, args=None):
# class SpinnerBar(Spinner):
# class BaBar(IncrementalBar):
# class GCPProgressReporter:
# class BotoCallbackHandler:
# class AutoForensicate(object):
# 
# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):
# 
# Path: auto_forensicate/uploader.py
# class BaseUploader(object):
# class LocalCopier(BaseUploader):
# class GCSUploader(BaseUploader):
#   def __init__(self, stamp_manager, stamp=None):
#   def _UploadStamp(self):
#   def _MakeRemotePath(self, destination):
#   def _UploadStream(self, stream, remote_path, update_callback=None):
#   def UploadArtifact(self, artifact, update_callback=None):
#   def __init__(self, destination_dir, stamp_manager, stamp=None):
#   def _UploadStream(self, stream, remote_path, update_callback=None):
#   def _MakeRemotePath(self, destination):
#   def __init__(self, gs_url, gs_keyfile, client_id, stamp_manager, stamp=None):
#   def _InitBoto(self):
#   def _SplitGCSUrl(self):
#   def _MakeRemotePath(self, destination):
#   def _UploadStream(self, stream, remote_path, update_callback=None):
# 
# Path: auto_forensicate/recipes/base.py
# class BaseArtifact(object):
# class StringArtifact(BaseArtifact):
# class FileArtifact(BaseArtifact):
# class ProcessOutputArtifact(BaseArtifact):
# class BaseRecipe(object):
#   def __init__(self, name):
#   def _GetStream(self):
#   def CloseStream(self):
#   def OpenStream(self):
#   def size(self):
#   def readable_size(self):
#   def __init__(self, path, string_content):
#   def _GetStream(self):
#   def CloseStream(self):
#   def __init__(self, path):
#   def _GetStream(self):
#   def __init__(self, command, path, ignore_failure=False):
#   def _RunCommand(self):
#   def _GetStream(self):
#   def __init__(self, name, options=None):
#   def __enter__(self):
#   def __exit__(self, exc_type, exc_value, traceback):
#   def GetArtifacts(self):


import argparse
import logging
import os
import sys
import tempfile
import unittest
import mock
from six import StringIO
from auto_forensicate import auto_acquire
from auto_forensicate import errors
from auto_forensicate import uploader
from auto_forensicate.recipes import base
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for the auto_forensicate script."""

from __future__ import unicode_literals



DEFAULT_ARTIFACT_CONTENT = os.urandom(1000)

# pylint: disable=missing-docstring
# pylint: disable=protected-access


class BytesIORecipe(base.BaseRecipe):
  """A Recipe returning 1 artifact with a BytesIO."""

  def __init__(self, name, options=None):
    super(BytesIORecipe, self).__init__(name, options=options)
    self.ran_collection = False

  def GetArtifacts(self):
    return [base.StringArtifact('fake/path', DEFAULT_ARTIFACT_CONTENT)]


class FailingRecipe(base.BaseRecipe):
  """A Recipe raising an IOError when running GetArtifact."""

  def GetArtifacts(self):

# Path: auto_forensicate/auto_acquire.py
# VALID_RECIPES = {
#     'directory': directory.DirectoryRecipe,
#     'disk': disk.DiskRecipe,
#     'firmware': firmware.ChipsecRecipe,
#     'sysinfo': sysinfo.SysinfoRecipe
# }
# DEFAULT_RECIPES = frozenset({'disk', 'firmware', 'sysinfo'})
# ARTIFACT_MIN_REPORTING_SIZE = 1024**3
# def HumanReadableBytes(byte_val, prefix='dec'):
#   def update_with_total(self, _unused_current_bytes, _unused_total_bytes):
#   def _Update(self, current_bytes):
#   def speed(self):
#   def update_with_total(self, current_bytes, _unused_total_bytes):
#   def __init__(self, artifact, progress_logger, reporting_frequency=5):
#   def _CheckReportable(self, percentage):
#   def update_with_total(self, current_bytes, _unused_total_bytes):
#   def __init__(self):
#   def RegisterCallback(self, callback):
#   def update_with_total(self, current_bytes, total_bytes):
#   def __init__(self, recipes=None):
#   def _CreateParser(self):
#   def _ParseLoggingArguments(self, options):
#   def _MakeUploader(self, options):
#   def ParseArguments(self, args):
#   def _ParseRecipes(self, options):
#   def _ParseGCSJSON(self, options):
#   def _MakeProgressBar(self, max_size, name, message=None):
#   def _MakeGCPProgressReporter(self, artifact):
#   def Do(self, recipe):
#   def _UploadArtifact(self, artifact, update_callback=None):
#   def _UploadArtifacts(self, artifacts):
#   def _Colorize(self, color, msg):
#   def Main(self, args=None):
# class SpinnerBar(Spinner):
# class BaBar(IncrementalBar):
# class GCPProgressReporter:
# class BotoCallbackHandler:
# class AutoForensicate(object):
# 
# Path: auto_forensicate/errors.py
# class BadConfigOption(Exception):
# class ForensicateError(Exception):
# class RecipeException(Exception):
# class RetryableError(ForensicateError):
# 
# Path: auto_forensicate/uploader.py
# class BaseUploader(object):
# class LocalCopier(BaseUploader):
# class GCSUploader(BaseUploader):
#   def __init__(self, stamp_manager, stamp=None):
#   def _UploadStamp(self):
#   def _MakeRemotePath(self, destination):
#   def _UploadStream(self, stream, remote_path, update_callback=None):
#   def UploadArtifact(self, artifact, update_callback=None):
#   def __init__(self, destination_dir, stamp_manager, stamp=None):
#   def _UploadStream(self, stream, remote_path, update_callback=None):
#   def _MakeRemotePath(self, destination):
#   def __init__(self, gs_url, gs_keyfile, client_id, stamp_manager, stamp=None):
#   def _InitBoto(self):
#   def _SplitGCSUrl(self):
#   def _MakeRemotePath(self, destination):
#   def _UploadStream(self, stream, remote_path, update_callback=None):
# 
# Path: auto_forensicate/recipes/base.py
# class BaseArtifact(object):
# class StringArtifact(BaseArtifact):
# class FileArtifact(BaseArtifact):
# class ProcessOutputArtifact(BaseArtifact):
# class BaseRecipe(object):
#   def __init__(self, name):
#   def _GetStream(self):
#   def CloseStream(self):
#   def OpenStream(self):
#   def size(self):
#   def readable_size(self):
#   def __init__(self, path, string_content):
#   def _GetStream(self):
#   def CloseStream(self):
#   def __init__(self, path):
#   def _GetStream(self):
#   def __init__(self, command, path, ignore_failure=False):
#   def _RunCommand(self):
#   def _GetStream(self):
#   def __init__(self, name, options=None):
#   def __enter__(self):
#   def __exit__(self, exc_type, exc_value, traceback):
#   def GetArtifacts(self):


# Path: tests/auto_forensicate_tests.py
import argparse
import logging
import os
import sys
import tempfile
import unittest
import mock
from six import StringIO
from auto_forensicate import auto_acquire
from auto_forensicate import errors
from auto_forensicate import uploader
from auto_forensicate.recipes import base

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for the auto_forensicate script."""

from __future__ import unicode_literals



DEFAULT_ARTIFACT_CONTENT = os.urandom(1000)

# pylint: disable=missing-docstring
# pylint: disable=protected-access


class BytesIORecipe(base.BaseRecipe):
  """A Recipe returning 1 artifact with a BytesIO."""

  def __init__(self, name, options=None):
    super(BytesIORecipe, self).__init__(name, options=options)
    self.ran_collection = False

  def GetArtifacts(self):
    return [base.StringArtifact('fake/path', DEFAULT_ARTIFACT_CONTENT)]


class FailingRecipe(base.BaseRecipe):
  """A Recipe raising an IOError when running GetArtifact."""

  def GetArtifacts(self):

    raise errors.RecipeException('Everything is terrible.')