1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-25 01:40:28 +02:00

Fully test registration app

This commit is contained in:
Yohann D'ANELLO
2020-09-24 14:15:42 +02:00
parent cedb693c5b
commit 1979d33314
6 changed files with 143 additions and 9 deletions

16
apps/api/tests.py Normal file
View File

@ -0,0 +1,16 @@
from django.contrib.auth.models import User
from django.test import TestCase
class TestAPIPages(TestCase):
def setUp(self):
self.user = User.objects.create_superuser(
username="admin",
password="apitest",
email="",
)
self.client.force_login(self.user)
def test_user_page(self):
response = self.client.get("/api/user/")
self.assertEqual(response.status_code, 200)

View File

@ -10,7 +10,7 @@ class UserViewSet(ModelViewSet):
"""
Display list of users.
"""
queryset = User.objects.all()
queryset = User.objects.order_by("id").all()
serializer_class = UserSerializer
filter_backends = [DjangoFilterBackend, SearchFilter]
filterset_fields = ['id', 'first_name', 'last_name', 'email', 'is_superuser', 'is_staff', 'is_active', ]