Skip to content
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

Add __eq__ method for permissions.OperandHolder class #8710

Merged
merged 1 commit into from
Oct 17, 2022

Conversation

janlis-ff
Copy link
Contributor

@janlis-ff janlis-ff commented Oct 16, 2022

The reason behind this proposal is to fully enable permission_classes comparison, e.g. in tests:

# myapp/views.py

from rest_framework.views import APIView
from rest_framework.permissions import IsAdminUser
from myapp.permissions import MyPermission


class MyView(APIView):
    permission_classes = [MyPermission | IsAdminUser]
    # ...
# myapp/tests/views/test_my_view.py

from myapp.views import MyView
from rest_framework.permissions import IsAdminUser
from myapp.permissions import MyPermission


def test__permission_classes():
    cls = MyView
    assert cls.permission_classes == [MyPermission | IsAdminUser]

I'd love to submit an actual test, but being a first-time contributor here I'm not sure where and how exactly would it fit in just by looking at tests/test_permissions.py.

Have a nice day!

@tomchristie
Copy link
Member

🤷‍♂️. Okay.

@tomchristie tomchristie merged commit 0cb6937 into encode:master Oct 17, 2022
@janlis-ff janlis-ff deleted the add-operand-holder-__eq__ branch October 17, 2022 10:42
@djowett
Copy link

djowett commented Dec 3, 2024

Just a passing note while reviewing an upgrade: should this not also be added to SingleOperandHolder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants