Opened 16 years ago
Closed 16 years ago
#9978 closed (fixed)
logout() method in test.client.Client raising KeyError
Reported by: | Igor Sobreira | Owned by: | Gary Wilson |
---|---|---|---|
Component: | Testing framework | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I've noticed this logout() method raises KeyError when I'm not authenticated.
I'm not sure it's a bug, but in my opinion it should fail silently. Catch the exception would solve it.
[1] http://code.djangoproject.com/browser/django/trunk/django/test/client.py#L413
Attachments (1)
Change History (5)
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
by , 16 years ago
comment:2 by , 16 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:3 by , 16 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
This is indeed a problem. If you log in and then log out, logout() doesn't cause an error. Only when you have never logged in and try to log out.
Attached is a simple testcase and a one line fix to the logout() function simple checking to see if that key exists before trying to delete it.