# Path: f5_heat/resources/f5_bigip_device.py
# class BigIPConnectionFailed(HTTPError):
# class F5BigIPDevice(resource.Resource):
#     PROPERTIES = (
#         IP,
#         USERNAME,
#         PASSWORD
#     ) = (
#         'ip',
#         'username',
#         'password'
#     )
#     def get_bigip(self):
#     def handle_create(self):
#     def handle_delete(self):
# def resource_mapping():
# 
# Path: f5_heat/resources/f5_bigip_device.py
# class BigIPConnectionFailed(HTTPError):
#     pass


from f5.bigip import ManagementRoot
from f5_heat.resources import f5_bigip_device
from f5_heat.resources.f5_bigip_device import BigIPConnectionFailed
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_create_http_error(F5BigIPHTTPError):
    with pytest.raises(BigIPConnectionFailed):
        F5BigIPHTTPError.handle_create()


def test_handle_delete(F5BigIP):
    delete_result = F5BigIP.handle_delete()
    assert delete_result is True


@mock.patch(
    'f5_heat.resources.f5_bigip_device.ManagementRoot.__init__',
    return_value=None
)
def test_bigip_getter(mock_mr_init):
    template_dict = mock_template(test_templ=bad_f5_bigip_defn)
    rsrc_def = create_resource_definition(template_dict)
    f5_bigip_obj = f5_bigip_device.F5BigIPDevice(
        'test',
        rsrc_def,
        mock.MagicMock()
    )
    bigip = f5_bigip_obj.get_bigip()
    assert isinstance(bigip, ManagementRoot)


@mock.patch('f5_heat.resources.f5_bigip_device.ManagementRoot')
def test_bad_property(mock_mr):
    template_dict = mock_template(test_templ=bad_f5_bigip_defn)
    rsrc_def = create_resource_definition(template_dict)

# Path: f5_heat/resources/f5_bigip_device.py
# class BigIPConnectionFailed(HTTPError):
# class F5BigIPDevice(resource.Resource):
#     PROPERTIES = (
#         IP,
#         USERNAME,
#         PASSWORD
#     ) = (
#         'ip',
#         'username',
#         'password'
#     )
#     def get_bigip(self):
#     def handle_create(self):
#     def handle_delete(self):
# def resource_mapping():
# 
# Path: f5_heat/resources/f5_bigip_device.py
# class BigIPConnectionFailed(HTTPError):
#     pass


# Path: f5_heat/resources/test/test_f5_bigip_device.py
from f5.bigip import ManagementRoot
from f5_heat.resources import f5_bigip_device
from f5_heat.resources.f5_bigip_device import BigIPConnectionFailed
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_create_http_error(F5BigIPHTTPError):
    with pytest.raises(BigIPConnectionFailed):
        F5BigIPHTTPError.handle_create()


def test_handle_delete(F5BigIP):
    delete_result = F5BigIP.handle_delete()
    assert delete_result is True


@mock.patch(
    'f5_heat.resources.f5_bigip_device.ManagementRoot.__init__',
    return_value=None
)
def test_bigip_getter(mock_mr_init):
    template_dict = mock_template(test_templ=bad_f5_bigip_defn)
    rsrc_def = create_resource_definition(template_dict)
    f5_bigip_obj = f5_bigip_device.F5BigIPDevice(
        'test',
        rsrc_def,
        mock.MagicMock()
    )
    bigip = f5_bigip_obj.get_bigip()
    assert isinstance(bigip, ManagementRoot)


@mock.patch('f5_heat.resources.f5_bigip_device.ManagementRoot')
def test_bad_property(mock_mr):
    template_dict = mock_template(test_templ=bad_f5_bigip_defn)
    rsrc_def = create_resource_definition(template_dict)

    f5_bigip_obj = f5_bigip_device.F5BigIPDevice(