Skip to content

change get_permissions to return list #500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion tests/typecheck/test_views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,30 @@
from typing import List

from rest_framework.viewsets import GenericViewSet
from rest_framework.permissions import BasePermission
from rest_framework.permissions import BasePermission, IsAdminUser

class MyView(GenericViewSet):
def get_permissions(self) -> List[BasePermission]:
...

- case: test_override_get_permissions_super
main: |
from typing import Sequence

from rest_framework.viewsets import GenericViewSet
from rest_framework.permissions import _SupportsHasPermission

class MyView(GenericViewSet):
def get_permissions(self) -> Sequence[_SupportsHasPermission]:
return super().get_permissions()

- case: test_override_get_permissions_operandholder
main: |
from typing import Sequence

from rest_framework.viewsets import GenericViewSet
from rest_framework.permissions import AND, IsAuthenticated, IsAdminUser, _SupportsHasPermission

class MyView(GenericViewSet):
def get_permissions(self) -> list[_SupportsHasPermission]:
return [AND(IsAuthenticated(), IsAdminUser())]