class MockView(object):
            serializer_class = DummyProductSerializerWithAllFields
            endpoint = ProductEndpoint(
                serializer=DummyProductSerializerWithAllFields)

            def get_serializer_class(self):
                return self.serializer_class
 def test_filter_and_search_fields_defined_on_viewset(self):
     endpoint = ProductEndpoint(viewset=DummyProductViewSet)
     self.assertTrue(endpoint.search_enabled)
     self.assertIn('name', endpoint.get_filter_fields())
        class MockView(object):
            serializer_class = DummyProductSerializer
            endpoint = ProductEndpoint(fields=['name'])

            def get_serializer_class(self):
                return self.serializer_class
Exemplo n.º 4
0
 class MockView(object):
     serializer_class = DummyProductSerializer
     endpoint = ProductEndpoint(fields=['name'])
 class MockView(object):
     serializer_class = DummyProductSerializer
     endpoint = ProductEndpoint(serializer=DummyProductSerializer)
Exemplo n.º 6
0
from django.conf.urls import include, url
from django.contrib import admin

from drf_auto_endpoint.router import router

from sample.endpoints import ProductEndpoint
from sample.models import Category, HowItWorks
from sample.views import AbstractHowItWorksViewSet, HomepageView, ProductViewSet
from export_app import urls as export_urls, settings as export_settings

router.register(endpoint=ProductEndpoint(), viewset=ProductViewSet)
router.register(Category)
router.register(HowItWorks, base_viewset=AbstractHowItWorksViewSet)

urlpatterns = [
    # url(r'^admin/', include(admin.site.urls)),
    url(r'^$', HomepageView.as_view()),
    url(r'^api/', include(router.urls)),
    url(r'^models/',
        include(export_urls, namespace=export_settings.URL_NAMESPACE)),
]