Exemplo n.º 1
0
    def testGetHelpString(self):
        """Tests the GetHelpString function."""
        recipe = resources.Recipe(self._DESCRIPTION, self._CONTENTS,
                                  self._ARGS)

        expected_help_string = (
            ' test                               recipe description\n')
        help_string = recipe.GetHelpString()
        self.assertEqual(help_string, expected_help_string)
Exemplo n.º 2
0
    def setUp(self):
        """Registers the dummy modules and recipe to be used in tests."""
        modules_manager.ModulesManager.RegisterModules(
            [modules.DummyModule1, modules.DummyModule2])

        self._recipe = resources.Recipe(test_recipe.__doc__,
                                        test_recipe.contents, test_recipe.args)
        self._recipes_manager = recipes_manager.RecipesManager()
        self._recipes_manager.RegisterRecipe(self._recipe)
Exemplo n.º 3
0
  def _ReadRecipeFromFileObject(self, file_object):
    """Reads a recipe from a JSON file-like object.

    Args:
      file_object (file): JSON file-like object that contains the recipe.

    Returns:
      Recipe: recipe.
    """
    json_dict = json.load(file_object)

    description = json_dict['description']
    del json_dict['description']

    args = json_dict['args']
    del json_dict['args']

    return resources.Recipe(description, json_dict, args)
Exemplo n.º 4
0
 def testInitialize(self):
     """Tests the __init__ function."""
     recipe = resources.Recipe(self._DESCRIPTION, self._CONTENTS,
                               self._ARGS)
     self.assertIsNotNone(recipe)