# -*- coding: utf-8 -*-

"""This module contains all the tests and related functions."""

from __future__ import unicode_literals

from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from sku.serializers import UserSerializer, GroupSerializer, CommentSerializer
from sku.models import Comment


class UserViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows users to be viewed or edited.
    """
    queryset = User.objects.all().order_by('-date_joined')
    serializer_class = UserSerializer


class GroupViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows groups to be viewed or edited.
    """
    queryset = Group.objects.all()
    serializer_class = GroupSerializer


class CommentViewSet(viewsets.ModelViewSet):
    """
    API endpoint that allows comments to be viewed or edited.
    """
    queryset = Comment.objects.all().order_by('-created')
    serializer_class = CommentSerializer
