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 , 4 years ago
Component: | Uncategorized → Testing framework |
---|---|
Has patch: | unset |
Summary: | tests: Signature of mocked User.has_perm() different from real implementation → Signature of mocked has_perm() methods is outdated. |
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 4 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Status: | new → assigned |
Triage Stage: | Accepted → Ready for checkin |
Note:
See TracTickets
for help on using tickets.
Patch is welcome.