# Path: bgpvpn_dashboard/api/bgpvpn.py
# LOG = logging.getLogger(__name__)
# class Bgpvpn(neutron.NeutronAPIDictWrapper):
# class NetworkAssociation(neutron.NeutronAPIDictWrapper):
# class RouterAssociation(neutron.NeutronAPIDictWrapper):
# def bgpvpns_list(request, **kwargs):
# def bgpvpn_get(request, bgpvpn_id, **kwargs):
# def bgpvpn_create(request, **kwargs):
# def bgpvpn_update(request, bgpvpn_id, **kwargs):
# def bgpvpn_delete(request, bgpvpn_id):
# def network_association_get(request, bgpvpn_id, network_assoc_id, **kwargs):
# def network_association_list(request, bgpvpn_id, **kwargs):
# def network_association_create(request, bgpvpn_id, **kwargs):
# def network_association_delete(request, resource_id, bgpvpn_id):
# def router_association_get(request, bgpvpn_id, router_assoc_id, **kwargs):
# def router_association_list(request, bgpvpn_id, **kwargs):
# def router_association_create(request, bgpvpn_id, **kwargs):
# def router_association_update(request, bgpvpn_id, router_association_id,
#                               **kwargs):
# def router_association_delete(request, resource_id, bgpvpn_id):
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/forms.py
# LOG = logging.getLogger(__name__)
# class CommonData(forms.SelfHandlingForm):
# class EditDataBgpVpn(CommonData):
# class CreateNetworkAssociation(forms.SelfHandlingForm):
#     def __init__(self, request, *args, **kwargs):
#     def _del_attributes(attributes, data):
#     def handle(self, request, data):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, request, *args, **kwargs):
#     def handle(self, request, data):
#     def _set_params(self, data):
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/tables.py
# class EditInfoBgpVpn(tables.LinkAction):
# class CreateNetworkAssociation(tables.LinkAction):
# class CreateRouterAssociation(tables.LinkAction):
# class NetworksColumn(tables.Column):
# class RoutersColumn(tables.Column):
# class BgpvpnTable(tables.DataTable):
#     class Meta(object):
#     def get_link_url(self, bgpvpn):
# def get_network_url(network):
# def get_router_url(router):
#     def get_raw_data(self, bgpvpn):
#     def get_raw_data(self, bgpvpn):
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/views.py
# class IndexView(tables.DataTableView):
# class EditDataView(forms.ModalFormView):
# class GetBgpvpnMixin(object):
# class CreateNetworkAssociationView(GetBgpvpnMixin, forms.ModalFormView):
# class CreateRouterAssociationView(GetBgpvpnMixin, workflows.WorkflowView):
# class DetailProjectView(tabs.TabbedTableView):
#     def get_data(self):
#     def _join_rts(route_targets_list):
#     def get_context_data(self, **kwargs):
#     def get_initial(self):
#     def get_initial(self):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_data(self):


from unittest import mock
from django.urls import reverse
from django.urls import reverse_lazy
from bgpvpn_dashboard.api import bgpvpn as bgpvpn_api
from bgpvpn_dashboard.dashboards.project.bgpvpn import forms as bgpvpn_form
from bgpvpn_dashboard.dashboards.project.bgpvpn import tables as bgpvpn_tables
from bgpvpn_dashboard.dashboards.project.bgpvpn import views as bgpvpn_views
from openstack_dashboard.test import helpers
            bgpvpn_info = {
                "name": "%s_name" % prefix,
                "route_targets": [],
                "import_targets": [],
                "export_targets": [],
                "networks": [],
                "routers": [],
                "tenant_id": "tenant_id",
                "type": "l3"
            }
        return bgpvpn_api.Bgpvpn(bgpvpn_info)

    @mock.patch.object(bgpvpn_views, 'bgpvpn_api', autospec=True)
    def test_get_data(self, mock_bgpvpn_api):
        """Test that get_data works."""

        bgpvpn_foo = self._get_mock_bgpvpn("foo")
        bgpvpn_bar = self._get_mock_bgpvpn("bar")

        mock_bgpvpn_api.bgpvpns_list.return_value = [bgpvpn_bar, bgpvpn_foo]
        result = self.bgpvpn_view.get_data()
        expected_bgpvpns = [bgpvpn_bar, bgpvpn_foo]
        self.assertEqual(expected_bgpvpns, result)


class TestEditDataView(helpers.APITestCase):

    def setUp(self):
        super(TestEditDataView, self).setUp()
        mock_request = mock.Mock(horizon={'async_messages': []})

# Path: bgpvpn_dashboard/api/bgpvpn.py
# LOG = logging.getLogger(__name__)
# class Bgpvpn(neutron.NeutronAPIDictWrapper):
# class NetworkAssociation(neutron.NeutronAPIDictWrapper):
# class RouterAssociation(neutron.NeutronAPIDictWrapper):
# def bgpvpns_list(request, **kwargs):
# def bgpvpn_get(request, bgpvpn_id, **kwargs):
# def bgpvpn_create(request, **kwargs):
# def bgpvpn_update(request, bgpvpn_id, **kwargs):
# def bgpvpn_delete(request, bgpvpn_id):
# def network_association_get(request, bgpvpn_id, network_assoc_id, **kwargs):
# def network_association_list(request, bgpvpn_id, **kwargs):
# def network_association_create(request, bgpvpn_id, **kwargs):
# def network_association_delete(request, resource_id, bgpvpn_id):
# def router_association_get(request, bgpvpn_id, router_assoc_id, **kwargs):
# def router_association_list(request, bgpvpn_id, **kwargs):
# def router_association_create(request, bgpvpn_id, **kwargs):
# def router_association_update(request, bgpvpn_id, router_association_id,
#                               **kwargs):
# def router_association_delete(request, resource_id, bgpvpn_id):
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/forms.py
# LOG = logging.getLogger(__name__)
# class CommonData(forms.SelfHandlingForm):
# class EditDataBgpVpn(CommonData):
# class CreateNetworkAssociation(forms.SelfHandlingForm):
#     def __init__(self, request, *args, **kwargs):
#     def _del_attributes(attributes, data):
#     def handle(self, request, data):
#     def __init__(self, request, *args, **kwargs):
#     def __init__(self, request, *args, **kwargs):
#     def handle(self, request, data):
#     def _set_params(self, data):
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/tables.py
# class EditInfoBgpVpn(tables.LinkAction):
# class CreateNetworkAssociation(tables.LinkAction):
# class CreateRouterAssociation(tables.LinkAction):
# class NetworksColumn(tables.Column):
# class RoutersColumn(tables.Column):
# class BgpvpnTable(tables.DataTable):
#     class Meta(object):
#     def get_link_url(self, bgpvpn):
# def get_network_url(network):
# def get_router_url(router):
#     def get_raw_data(self, bgpvpn):
#     def get_raw_data(self, bgpvpn):
# 
# Path: bgpvpn_dashboard/dashboards/project/bgpvpn/views.py
# class IndexView(tables.DataTableView):
# class EditDataView(forms.ModalFormView):
# class GetBgpvpnMixin(object):
# class CreateNetworkAssociationView(GetBgpvpnMixin, forms.ModalFormView):
# class CreateRouterAssociationView(GetBgpvpnMixin, workflows.WorkflowView):
# class DetailProjectView(tabs.TabbedTableView):
#     def get_data(self):
#     def _join_rts(route_targets_list):
#     def get_context_data(self, **kwargs):
#     def get_initial(self):
#     def get_initial(self):
#     def get_context_data(self, **kwargs):
#     def get_context_data(self, **kwargs):
#     def get_data(self):


# Path: bgpvpn_dashboard/test/project/test_views.py
from unittest import mock
from django.urls import reverse
from django.urls import reverse_lazy
from bgpvpn_dashboard.api import bgpvpn as bgpvpn_api
from bgpvpn_dashboard.dashboards.project.bgpvpn import forms as bgpvpn_form
from bgpvpn_dashboard.dashboards.project.bgpvpn import tables as bgpvpn_tables
from bgpvpn_dashboard.dashboards.project.bgpvpn import views as bgpvpn_views
from openstack_dashboard.test import helpers

            bgpvpn_info = {
                "name": "%s_name" % prefix,
                "route_targets": [],
                "import_targets": [],
                "export_targets": [],
                "networks": [],
                "routers": [],
                "tenant_id": "tenant_id",
                "type": "l3"
            }
        return bgpvpn_api.Bgpvpn(bgpvpn_info)

    @mock.patch.object(bgpvpn_views, 'bgpvpn_api', autospec=True)
    def test_get_data(self, mock_bgpvpn_api):
        """Test that get_data works."""

        bgpvpn_foo = self._get_mock_bgpvpn("foo")
        bgpvpn_bar = self._get_mock_bgpvpn("bar")

        mock_bgpvpn_api.bgpvpns_list.return_value = [bgpvpn_bar, bgpvpn_foo]
        result = self.bgpvpn_view.get_data()
        expected_bgpvpns = [bgpvpn_bar, bgpvpn_foo]
        self.assertEqual(expected_bgpvpns, result)


class TestEditDataView(helpers.APITestCase):

    def setUp(self):
        super(TestEditDataView, self).setUp()
        mock_request = mock.Mock(horizon={'async_messages': []})

        self.bgpvpn_view = bgpvpn_views.EditDataView(request=mock_request)