Commit 4947602d authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

Make permissions for any for the moment and fix tests

parent bb3cf668
Pipeline #12858 passed with stage
in 1 minute and 5 seconds
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.decorators import (
api_view,
authentication_classes,
permission_classes
)
from rest_framework.response import Response
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
......@@ -8,6 +12,8 @@ from metagenedb.apps.catalog.serializers import GeneSerializer
@api_view(['GET'])
@authentication_classes(())
@permission_classes(())
def gene_list(request):
"""
List genes
......
......@@ -11,15 +11,15 @@ class TestGenes(TestCase):
def test_get_genes_no_auth(self):
"""
Unauthenticated users should not be able to access genes via APIListView
Unauthenticated users should be able to access genes
"""
url = reverse('genes')
resp = self.client.get(url)
self.assertEqual(resp.status_code, status.HTTP_401_UNAUTHORIZED)
self.assertEqual(resp.status_code, status.HTTP_200_OK)
def test_get_genes_auth(self):
"""
Authenticated users should be able to access genes via APIListView
Authenticated users should be able to access genes
"""
jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
......
......@@ -98,11 +98,11 @@ CORS_ORIGIN_WHITELIST = (
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
# 'rest_framework.permissions.IsAuthenticated',
'rest_framework.permissions.AllowAny',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
# 'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
# 'rest_framework.authentication.SessionAuthentication',
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'rest_framework.authentication.SessionAuthentication',
# 'rest_framework.authentication.BasicAuthentication',
),
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment