# Path: f5_heat/resources/f5_sys_iappfulltemplate.py
# class IappFullTemplateValidationFailed(exception.StackValidationFailed):
# class F5SysiAppFullTemplate(F5BigIPMixin, resource.Resource):
#     PROPERTIES = (
#         BIGIP_SERVER,
#         PARTITION,
#         FULL_TEMPLATE
#     ) = (
#         'bigip_server',
#         'partition',
#         'full_template'
#     )
#     def __init__(self, name, defn, stack):
#     def _parse_full_template(self):
#     def _validate_template_partition(self):
#     def handle_create(self):
#     def handle_delete(self):
# def resource_mapping():
# 
# Path: f5_heat/resources/f5_sys_iappfulltemplate.py
# class IappFullTemplateValidationFailed(exception.StackValidationFailed):
#     pass


from f5_heat.resources import f5_sys_iappfulltemplate
from f5_heat.resources.f5_sys_iappfulltemplate import \
    IappFullTemplateValidationFailed
from heat.common import exception
from heat.common import template_format
from heat.engine.hot.template import HOTemplate20150430
from heat.engine import rsrc_defn
from heat.engine import template
import mock
import pytest

def test_handle_delete(F5SysiAppTemplateExists):
    delete_result = F5SysiAppTemplateExists.handle_delete()
    assert delete_result is True
    assert F5SysiAppTemplateExists.bigip.tm.sys.application.templates.\
        template.load.call_args == \
        mock.call(name='testing_template', partition='Common')


def test_handle_delete_no_exists(F5SysiAppTemplateNoExists):
    assert F5SysiAppTemplateNoExists.handle_delete() is True


def test_handle_delete_error(DeleteTemplateSideEffect):
    '''Currently, test exists to satisfy 100% code coverage.'''
    with pytest.raises(exception.ResourceFailure):
        DeleteTemplateSideEffect.handle_delete()


def test_resource_mapping():
    rsrc_map = f5_sys_iappfulltemplate.resource_mapping()
    assert rsrc_map == {
        'F5::Sys::iAppFullTemplate':
        f5_sys_iappfulltemplate.F5SysiAppFullTemplate
    }


def test_template_validated_failure():
    template_dict = mock_template(test_templ=bad_iapp_template_defn)
    rsrc_def = create_resource_definition(template_dict)

# Path: f5_heat/resources/f5_sys_iappfulltemplate.py
# class IappFullTemplateValidationFailed(exception.StackValidationFailed):
# class F5SysiAppFullTemplate(F5BigIPMixin, resource.Resource):
#     PROPERTIES = (
#         BIGIP_SERVER,
#         PARTITION,
#         FULL_TEMPLATE
#     ) = (
#         'bigip_server',
#         'partition',
#         'full_template'
#     )
#     def __init__(self, name, defn, stack):
#     def _parse_full_template(self):
#     def _validate_template_partition(self):
#     def handle_create(self):
#     def handle_delete(self):
# def resource_mapping():
# 
# Path: f5_heat/resources/f5_sys_iappfulltemplate.py
# class IappFullTemplateValidationFailed(exception.StackValidationFailed):
#     pass


# Path: f5_heat/resources/test/test_f5_sys_iappfulltemplate.py
from f5_heat.resources import f5_sys_iappfulltemplate
from f5_heat.resources.f5_sys_iappfulltemplate import \
    IappFullTemplateValidationFailed
from heat.common import exception
from heat.common import template_format
from heat.engine.hot.template import HOTemplate20150430
from heat.engine import rsrc_defn
from heat.engine import template
import mock
import pytest


def test_handle_delete(F5SysiAppTemplateExists):
    delete_result = F5SysiAppTemplateExists.handle_delete()
    assert delete_result is True
    assert F5SysiAppTemplateExists.bigip.tm.sys.application.templates.\
        template.load.call_args == \
        mock.call(name='testing_template', partition='Common')


def test_handle_delete_no_exists(F5SysiAppTemplateNoExists):
    assert F5SysiAppTemplateNoExists.handle_delete() is True


def test_handle_delete_error(DeleteTemplateSideEffect):
    '''Currently, test exists to satisfy 100% code coverage.'''
    with pytest.raises(exception.ResourceFailure):
        DeleteTemplateSideEffect.handle_delete()


def test_resource_mapping():
    rsrc_map = f5_sys_iappfulltemplate.resource_mapping()
    assert rsrc_map == {
        'F5::Sys::iAppFullTemplate':
        f5_sys_iappfulltemplate.F5SysiAppFullTemplate
    }


def test_template_validated_failure():
    template_dict = mock_template(test_templ=bad_iapp_template_defn)
    rsrc_def = create_resource_definition(template_dict)

    f5_sys_iapptemplate_obj = f5_sys_iappfulltemplate.F5SysiAppFullTemplate(