# 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: auto_forensicate/recipes/firmware.py
# class ChipsecRecipe(base.BaseRecipe):
#   _CHIPSEC_CMD = [
#       'chipsec_util', '-l', '/dev/stderr', 'spi', 'dump', '/dev/stdout']
#   def GetArtifacts(self):


import unittest
from auto_forensicate.recipes import base
from auto_forensicate.recipes import firmware
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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 firmware.py module."""

from __future__ import unicode_literals



class ChipsecRecipeTests(unittest.TestCase):
  """Tests for the ChipsecRecipe class."""

  _CHIPSEC_OUTPUT_STRING = b'\xff' * 256

  def testGetArtifacts(self):
    """Tests for the GetArtifacts() method."""
    chipsec_recipe = firmware.ChipsecRecipe('chipsec')
    #pylint: disable=protected-access
    chipsec_recipe._platform = 'linux'
    chipsec_recipe._CHIPSEC_CMD = [
        'echo', '-n', self._CHIPSEC_OUTPUT_STRING]

    artifacts = chipsec_recipe.GetArtifacts()
    self.assertEqual(len(artifacts), 1)

    artifact = artifacts[0]

# 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: auto_forensicate/recipes/firmware.py
# class ChipsecRecipe(base.BaseRecipe):
#   _CHIPSEC_CMD = [
#       'chipsec_util', '-l', '/dev/stderr', 'spi', 'dump', '/dev/stdout']
#   def GetArtifacts(self):


# Path: tests/firmware_tests.py
import unittest
from auto_forensicate.recipes import base
from auto_forensicate.recipes import firmware

#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# 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 firmware.py module."""

from __future__ import unicode_literals



class ChipsecRecipeTests(unittest.TestCase):
  """Tests for the ChipsecRecipe class."""

  _CHIPSEC_OUTPUT_STRING = b'\xff' * 256

  def testGetArtifacts(self):
    """Tests for the GetArtifacts() method."""
    chipsec_recipe = firmware.ChipsecRecipe('chipsec')
    #pylint: disable=protected-access
    chipsec_recipe._platform = 'linux'
    chipsec_recipe._CHIPSEC_CMD = [
        'echo', '-n', self._CHIPSEC_OUTPUT_STRING]

    artifacts = chipsec_recipe.GetArtifacts()
    self.assertEqual(len(artifacts), 1)

    artifact = artifacts[0]

    self.assertIsInstance(artifact, base.ProcessOutputArtifact)