Opened 4 years ago

Closed 4 years ago

#32003 closed Cleanup/optimization (fixed)

Signature of mocked has_perm() methods is outdated.

Reported by: Alexander Todorov Owned by: Alexander Todorov
Component: Testing framework Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In particular all of the mocked methods receive 2 arguments: self, perm while the real one in PermissionsMixin also has a keyword agument called obj.

This gets in the way of trying to work on passing the object to user.has_perm() in ModelAdmin because it will cause the tests to fail artificially.

I have a commit at https://github.com/atodorov/django/commits/fix_mocked_has_perm which doesn't fail locally and seems to do the job.
Let me know if you want me to open a pull request.

Change History (3)

comment:1 by Mariusz Felisiak, 4 years ago

Component: UncategorizedTesting framework
Has patch: unset
Summary: tests: Signature of mocked User.has_perm() different from real implementationSignature of mocked has_perm() methods is outdated.
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Patch is welcome.

comment:2 by Mariusz Felisiak, 4 years ago

Has patch: set
Owner: changed from nobody to Alexander Todorov
Status: newassigned
Triage Stage: AcceptedReady for checkin

comment:3 by GitHub <noreply@…>, 4 years ago

Resolution: fixed
Status: assignedclosed

In 5fab1639:

Fixed #32003 -- Added obj argument to has_perm() methods in tests.

Note: See TracTickets for help on using tickets.
Back to Top