# Path: tests/support/decorators.py

# 
# Path: tests/support/views.py
# class ArtistViewSet(BaseViewSet):
#     """A simple ViewSet for listing or retrieving artists."""
# 
#     serializer_class = ArtistSerializer
#     # This is not testing pagination
#     pagination_class: Optional[Type[BasePagination]] = None
# 
#     def get_queryset(self) -> QuerySet[Artist]:
#         """Return the list of artists."""
#         return get_artists()
# 
# class AlbumViewSet(BaseViewSet):
#     """A simple ViewSet for listing or retrieving albums."""
# 
#     pagination_class = None
# 
#     def get_queryset(self) -> QuerySet[Album]:
#         """Return the list of albums."""
#         return get_albums()
# 
#     def get_serializer(self, *args: Any, **kwargs: Any) -> BaseSerializer:
#         """Test the use of dynamic serializers with the parser."""
#         return AlbumSerializer(*args, **kwargs)
# 
#     @action_route
#     def relationship_artist(self) -> Response:
#         """Do nothing."""
#         # Not currently called, just reversed.
#         return Response()
# 
#     @action_route
#     def related_artist(self) -> Response:
#         """Do nothing."""
#         # Not currently called, just reversed.
#         return Response()
# 
# class TrackViewSet(BaseViewSet):
#     """A simple ViewSet for listing or retrieving tracks."""
# 
#     serializer_class = TrackSerializer
#     pagination_class = None
# 
#     def get_queryset(self) -> QuerySet[Track]:
#         """Return the list of tracks."""
#         return get_tracks()


import json
from django.urls import reverse
from rest_framework.test import APIRequestFactory
from tests.support.decorators import mark_urls
from tests.support.views import ArtistViewSet, AlbumViewSet, TrackViewSet
            },
            {
                "id": "1",
                "type": "track",
                "attributes": {"name": "Moon Dreams", "trackNum": 2},
                "relationships": {"album": {"data": {"id": "1", "type": "album"}}},
            },
            {
                "id": "2",
                "type": "track",
                "attributes": {"name": "Venus de Milo", "trackNum": 3},
                "relationships": {"album": {"data": {"id": "1", "type": "album"}}},
            },
            {
                "id": "3",
                "type": "track",
                "attributes": {"name": "Deception", "trackNum": 4},
                "relationships": {"album": {"data": {"id": "1", "type": "album"}}},
            },
        ],
    }


@mark_urls
def test_relationships_fields(factory: APIRequestFactory) -> None:
    """You can use fields to specify specific relationships fields."""
    request = factory.get(
        reverse("album-detail", kwargs={"pk": 0}),
        {"fields[album]": "artist", "fields[artist]": "firstName", "include": "artist"},
    )

# Path: tests/support/decorators.py

# 
# Path: tests/support/views.py
# class ArtistViewSet(BaseViewSet):
#     """A simple ViewSet for listing or retrieving artists."""
# 
#     serializer_class = ArtistSerializer
#     # This is not testing pagination
#     pagination_class: Optional[Type[BasePagination]] = None
# 
#     def get_queryset(self) -> QuerySet[Artist]:
#         """Return the list of artists."""
#         return get_artists()
# 
# class AlbumViewSet(BaseViewSet):
#     """A simple ViewSet for listing or retrieving albums."""
# 
#     pagination_class = None
# 
#     def get_queryset(self) -> QuerySet[Album]:
#         """Return the list of albums."""
#         return get_albums()
# 
#     def get_serializer(self, *args: Any, **kwargs: Any) -> BaseSerializer:
#         """Test the use of dynamic serializers with the parser."""
#         return AlbumSerializer(*args, **kwargs)
# 
#     @action_route
#     def relationship_artist(self) -> Response:
#         """Do nothing."""
#         # Not currently called, just reversed.
#         return Response()
# 
#     @action_route
#     def related_artist(self) -> Response:
#         """Do nothing."""
#         # Not currently called, just reversed.
#         return Response()
# 
# class TrackViewSet(BaseViewSet):
#     """A simple ViewSet for listing or retrieving tracks."""
# 
#     serializer_class = TrackSerializer
#     pagination_class = None
# 
#     def get_queryset(self) -> QuerySet[Track]:
#         """Return the list of tracks."""
#         return get_tracks()


# Path: tests/test_renderers.py
import json
from django.urls import reverse
from rest_framework.test import APIRequestFactory
from tests.support.decorators import mark_urls
from tests.support.views import ArtistViewSet, AlbumViewSet, TrackViewSet

            },
            {
                "id": "1",
                "type": "track",
                "attributes": {"name": "Moon Dreams", "trackNum": 2},
                "relationships": {"album": {"data": {"id": "1", "type": "album"}}},
            },
            {
                "id": "2",
                "type": "track",
                "attributes": {"name": "Venus de Milo", "trackNum": 3},
                "relationships": {"album": {"data": {"id": "1", "type": "album"}}},
            },
            {
                "id": "3",
                "type": "track",
                "attributes": {"name": "Deception", "trackNum": 4},
                "relationships": {"album": {"data": {"id": "1", "type": "album"}}},
            },
        ],
    }


@mark_urls
def test_relationships_fields(factory: APIRequestFactory) -> None:
    """You can use fields to specify specific relationships fields."""
    request = factory.get(
        reverse("album-detail", kwargs={"pk": 0}),
        {"fields[album]": "artist", "fields[artist]": "firstName", "include": "artist"},
    )

    view_detail = AlbumViewSet.as_view({"get": "retrieve"})