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

Provide tests for hashing of OperandHolder #9437

Merged
merged 1 commit into from
Jun 15, 2024
Merged

Conversation

vanya909
Copy link
Contributor

Description

Provide tests for #9417 according to comment

@auvipy auvipy requested a review from a team June 15, 2024 07:58
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the followup contribution!

@auvipy auvipy merged commit 1e9b5c1 into encode:master Jun 15, 2024
7 checks passed
@@ -716,3 +716,59 @@ def has_object_permission(self, request, view, obj):
composed_perm = (IsAuthenticatedUserOwner | permissions.IsAdminUser)
hasperm = composed_perm().has_object_permission(request, None, None)
assert hasperm is False

def test_operand_holder_is_hashable(self):
assert hash((permissions.IsAuthenticated & permissions.IsAdminUser))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May fail if hash returns zero. The proper check would be that no exception is thrown. (E.g., via >= 0)

Comment on lines +769 to +772
filtered_permissions = [
perm for perm
in dict.fromkeys(unfiltered_permissions)
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filtered_permissions = list(dict.fromkeys(unfiltered_permissions))

@vanya909
Copy link
Contributor Author

@peterthomassen Should I open PR for these fixes?

@peterthomassen
Copy link
Contributor

I don't think so; just trying to enable the community to learn from each other! :-) Thanks for the tests, I like how they are set up.

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

Successfully merging this pull request may close these issues.

None yet

3 participants