# Path: modeladminutils/edit_handlers.py
# class AdminModelChooserPanel(object):
#     def __init__(self, field_name):
#         self.field_name = field_name
# 
#     def bind_to_model(self, model):
#         return type(
#             str('_AdminModelChooserPanel'),
#             (BaseAdminModelChooserPanel,),
#             {
#                 'model': model,
#                 'field_name': self.field_name,
#             }
#         )


import pytest
from wagtail.tests.testapp.models import PageChooserModel
from wagtail.wagtailadmin.edit_handlers import ObjectList
from wagtail.wagtailcore.models import Page
from modeladminutils.edit_handlers import AdminModelChooserPanel



class TestAdminModelChooserPanel(object):
    @pytest.fixture
    def model(self):
        """A model with a foreign key to Page
        which we want to render as a page chooser
        """
        return PageChooserModel

    @pytest.fixture
    def edit_handler_class(self, model):
        """A AdminModelChooserPanel class that works on
        PageChooserModel's 'page' field
        """

# Path: modeladminutils/edit_handlers.py
# class AdminModelChooserPanel(object):
#     def __init__(self, field_name):
#         self.field_name = field_name
# 
#     def bind_to_model(self, model):
#         return type(
#             str('_AdminModelChooserPanel'),
#             (BaseAdminModelChooserPanel,),
#             {
#                 'model': model,
#                 'field_name': self.field_name,
#             }
#         )


# Path: tests/test_modeladminutils/test_edit_handlers.py
import pytest
from wagtail.tests.testapp.models import PageChooserModel
from wagtail.wagtailadmin.edit_handlers import ObjectList
from wagtail.wagtailcore.models import Page
from modeladminutils.edit_handlers import AdminModelChooserPanel




class TestAdminModelChooserPanel(object):
    @pytest.fixture
    def model(self):
        """A model with a foreign key to Page
        which we want to render as a page chooser
        """
        return PageChooserModel

    @pytest.fixture
    def edit_handler_class(self, model):
        """A AdminModelChooserPanel class that works on
        PageChooserModel's 'page' field
        """

        object_list = ObjectList([AdminModelChooserPanel('page')])