# Path: groundwork/patterns/gw_recipes_pattern.py
# class IncorrectParameterTypeException(BaseException):
#     pass
# 
# class HooksException(BaseException):
#     pass
# 
# class RecipeMissingException(BaseException):
#     pass


import os
import pytest
from groundwork.patterns.gw_recipes_pattern import IncorrectParameterTypeException, \
    HooksException, RecipeMissingException
def test_recipe_registration_with_hooks(basicApp):
    plugin = basicApp.plugins.get("RecipePlugin")
    plugin.recipes.register("recipe_hooks",
                            os.path.join(os.path.dirname(__file__), "../recipes/gw_test_app"),
                            "test recipe", "Installation done", pre_hook=pre_hook_test_function_positive,
                            post_hook=post_hook_test_function_positive)
    test_recipe = basicApp.recipes.get("recipe_hooks")
    assert test_recipe is not None


def test_recipe_registration_with_hooks_parameter_none(basicApp):
    plugin = basicApp.plugins.get("RecipePlugin")
    plugin.recipes.register("recipe_hooks_none",
                            os.path.join(os.path.dirname(__file__), "../recipes/gw_test_app"),
                            "test recipe", "Installation done", pre_hook=None,
                            post_hook=None)
    test_recipe = basicApp.recipes.get("recipe_hooks_none")
    assert test_recipe is not None


def test_recipe_registration_with_hooks_incorrect_parameter_type_prehook(basicApp):
    basicApp.plugins.get("RecipePlugin")
    with pytest.raises(IncorrectParameterTypeException):
        basicApp.recipes.register("test",
                                  os.path.join(os.path.dirname(__file__), "../recipes/gw_test_app"),
                                  "test recipe", "Installation done", pre_hook="incorrect_parameter")


def test_recipe_registration_with_hooks_incorrect_parameter_type_posthook(basicApp):
    basicApp.plugins.get("RecipePlugin")

# Path: groundwork/patterns/gw_recipes_pattern.py
# class IncorrectParameterTypeException(BaseException):
#     pass
# 
# class HooksException(BaseException):
#     pass
# 
# class RecipeMissingException(BaseException):
#     pass


# Path: tests/test_recipes.py
import os
import pytest
from groundwork.patterns.gw_recipes_pattern import IncorrectParameterTypeException, \
    HooksException, RecipeMissingException

def test_recipe_registration_with_hooks(basicApp):
    plugin = basicApp.plugins.get("RecipePlugin")
    plugin.recipes.register("recipe_hooks",
                            os.path.join(os.path.dirname(__file__), "../recipes/gw_test_app"),
                            "test recipe", "Installation done", pre_hook=pre_hook_test_function_positive,
                            post_hook=post_hook_test_function_positive)
    test_recipe = basicApp.recipes.get("recipe_hooks")
    assert test_recipe is not None


def test_recipe_registration_with_hooks_parameter_none(basicApp):
    plugin = basicApp.plugins.get("RecipePlugin")
    plugin.recipes.register("recipe_hooks_none",
                            os.path.join(os.path.dirname(__file__), "../recipes/gw_test_app"),
                            "test recipe", "Installation done", pre_hook=None,
                            post_hook=None)
    test_recipe = basicApp.recipes.get("recipe_hooks_none")
    assert test_recipe is not None


def test_recipe_registration_with_hooks_incorrect_parameter_type_prehook(basicApp):
    basicApp.plugins.get("RecipePlugin")
    with pytest.raises(IncorrectParameterTypeException):
        basicApp.recipes.register("test",
                                  os.path.join(os.path.dirname(__file__), "../recipes/gw_test_app"),
                                  "test recipe", "Installation done", pre_hook="incorrect_parameter")


def test_recipe_registration_with_hooks_incorrect_parameter_type_posthook(basicApp):
    basicApp.plugins.get("RecipePlugin")

    with pytest.raises(IncorrectParameterTypeException):