Skip to content

Commit 9b81fcc

Browse files
Remove unused problem list view
1 parent 7e7c79e commit 9b81fcc

2 files changed

Lines changed: 2 additions & 39 deletions

File tree

backend/problem/views/problem.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from rest_framework.decorators import action
2+
from rest_framework.exceptions import MethodNotAllowed
23
from rest_framework.request import Request
34
from rest_framework.response import Response
45
from rest_framework.viewsets import ModelViewSet
@@ -51,18 +52,7 @@ def get_permissions(self):
5152
return [IsAuthenticatedOrReadOnly()]
5253

5354
def list(self, request: Request) -> Response:
54-
"""
55-
Lists all Problems in the database, with optional filtering.
56-
"""
57-
filters = get_filters(request.query_params)
58-
59-
qs = self.get_queryset()
60-
61-
if filters is not None:
62-
qs = qs.filter(filters)
63-
64-
serializer = self.get_serializer(qs, many=True)
65-
return Response(serializer.data, status=HTTP_200_OK)
55+
raise MethodNotAllowed(request.method)
6656

6757
@action(detail=False, methods=["get"], url_path="first")
6858
def first(self, request: Request) -> Response:

backend/problem/views/problem_test.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,6 @@ class TestProblemViewPermissions:
2727
Tests for problem view permissions as documented in the README.
2828
"""
2929

30-
# List / browse
31-
32-
def test_unauthenticated_user_can_list_problems(self, client, sample_problem):
33-
"""Unauthenticated users should be able to browse problems (read-only)."""
34-
response = client.get("/api/problem/")
35-
assert response.status_code == status.HTTP_200_OK
36-
37-
def test_visitor_can_list_problems(self, client, visitor, sample_problem):
38-
"""Visitors should be able to browse problems."""
39-
client.force_login(user=visitor)
40-
response = client.get("/api/problem/")
41-
assert response.status_code == status.HTTP_200_OK
42-
43-
def test_annotator_can_list_problems(self, client, annotator, sample_problem):
44-
"""Annotators should be able to browse problems."""
45-
client.force_login(user=annotator)
46-
response = client.get("/api/problem/")
47-
assert response.status_code == status.HTTP_200_OK
48-
49-
def test_master_annotator_can_list_problems(
50-
self, client, master_annotator, sample_problem
51-
):
52-
"""Master annotators should be able to browse problems."""
53-
client.force_login(user=master_annotator)
54-
response = client.get("/api/problem/")
55-
assert response.status_code == status.HTTP_200_OK
56-
5730
# Retrieve / browse single
5831

5932
def test_unauthenticated_user_can_retrieve_problem(self, client, sample_problem):

0 commit comments

Comments
 (0)