# Path: f5_heat/resources/f5_ltm_virtualserver.py
# class F5LTMVirtualServer(resource.Resource, F5BigIPMixin):
#     PROPERTIES = (
#         NAME,
#         BIGIP_SERVER,
#         PARTITION,
#         IP,
#         PORT,
#         DEFAULT_POOL,
#         VLANS
#     ) = (
#         'name',
#         'bigip_server',
#         'partition',
#         'ip',
#         'port',
#         'default_pool',
#         'vlans'
#     )
#     def handle_create(self):
#     def handle_delete(self):
# def resource_mapping():


from f5_heat.resources import f5_ltm_virtualserver
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

@mock.patch.object(template, 'get_version', return_value=versions)
@mock.patch.object(
    template,
    'get_template_class',
    return_value=HOTemplate20150430
)
def mock_template(templ_vers, templ_class, test_templ=vs_defn):
    '''Mock a Heat template for the Kilo version.'''
    templ_dict = template_format.parse(test_templ)
    return templ_dict


def create_resource_definition(templ_dict):
    '''Create resource definition.'''
    rsrc_def = rsrc_defn.ResourceDefinition(
        'test_stack',
        templ_dict['resources']['vs']['type'],
        properties=templ_dict['resources']['vs']['properties']
    )
    return rsrc_def


@pytest.fixture
def F5LTMVirtualServer():
    '''Instantiate the F5SysiAppService resource.'''
    template_dict = mock_template()
    rsrc_def = create_resource_definition(template_dict)
    mock_stack = mock.MagicMock()
    mock_stack.resource_by_refid().get_partition_name.return_value = 'Common'

# Path: f5_heat/resources/f5_ltm_virtualserver.py
# class F5LTMVirtualServer(resource.Resource, F5BigIPMixin):
#     PROPERTIES = (
#         NAME,
#         BIGIP_SERVER,
#         PARTITION,
#         IP,
#         PORT,
#         DEFAULT_POOL,
#         VLANS
#     ) = (
#         'name',
#         'bigip_server',
#         'partition',
#         'ip',
#         'port',
#         'default_pool',
#         'vlans'
#     )
#     def handle_create(self):
#     def handle_delete(self):
# def resource_mapping():


# Path: f5_heat/resources/test/test_f5_ltm_virtualserver.py
from f5_heat.resources import f5_ltm_virtualserver
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


@mock.patch.object(template, 'get_version', return_value=versions)
@mock.patch.object(
    template,
    'get_template_class',
    return_value=HOTemplate20150430
)
def mock_template(templ_vers, templ_class, test_templ=vs_defn):
    '''Mock a Heat template for the Kilo version.'''
    templ_dict = template_format.parse(test_templ)
    return templ_dict


def create_resource_definition(templ_dict):
    '''Create resource definition.'''
    rsrc_def = rsrc_defn.ResourceDefinition(
        'test_stack',
        templ_dict['resources']['vs']['type'],
        properties=templ_dict['resources']['vs']['properties']
    )
    return rsrc_def


@pytest.fixture
def F5LTMVirtualServer():
    '''Instantiate the F5SysiAppService resource.'''
    template_dict = mock_template()
    rsrc_def = create_resource_definition(template_dict)
    mock_stack = mock.MagicMock()
    mock_stack.resource_by_refid().get_partition_name.return_value = 'Common'

    f5_vs_obj = f5_ltm_virtualserver.F5LTMVirtualServer(