Coverage for django_napse/api/orders/views/order_view.py: 65%

17 statements  

« prev     ^ index     » next       coverage.py v7.4.3, created at 2024-03-12 13:49 +0000

1from django.conf import settings 

2from rest_framework import status 

3from rest_framework.response import Response 

4 

5from django_napse.api.custom_viewset import CustomViewSet 

6from django_napse.api.orders.serializers import OrderSerializer 

7from django_napse.core.models import Order 

8 

9 

10class OrderView(CustomViewSet): 

11 """.""" 

12 

13 # permission_classes = [HasAPIKey, HasSpace] 

14 permission_classes = [] 

15 serializer_class = OrderSerializer 

16 

17 def get_queryset(self): 

18 print(f"count: {Order.objects.count()}") 

19 return Order.objects.all() 

20 

21 def list(self, request): 

22 """For test & debug purposes only.""" 

23 if not settings.DEBUG: 

24 return Response(status=status.HTTP_404_NOT_FOUND) 

25 serializer = self.get_serializer(self.get_queryset(), many=True) 

26 return Response(serializer.data, status=status.HTTP_200_OK)