Opened 6 years ago

Closed 5 years ago

#9978 closed (fixed)

logout() method in test.client.Client raising KeyError

Reported by: igors Owned by: gwilson
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: UI/UX:


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.


Attachments (1)

9788.diff (2.2 KB) - added by ericholscher 5 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 Changed 5 years ago by ericholscher

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to ericholscher
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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.

Changed 5 years ago by ericholscher

comment:2 Changed 5 years ago by jacob

  • Triage Stage changed from Accepted to Ready for checkin

comment:3 Changed 5 years ago by gwilson

  • Owner changed from ericholscher to gwilson
  • Status changed from new to assigned

comment:4 Changed 5 years ago by gwilson

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [10228]) Fixed #9978 -- Fixed a KeyError exception that was being raised when using the logout method on the test client on an unauthenticated user, based on patch from ericholscher.

Add Comment

Modify Ticket

Change Properties
<Author field>
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.