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)
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)
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)
def testInitialize(self): """Tests the __init__ function.""" recipe = resources.Recipe(self._DESCRIPTION, self._CONTENTS, self._ARGS) self.assertIsNotNone(recipe)