Opened 5 years ago

Closed 5 years ago

#26175 closed Cleanup/optimization (fixed)

Use create_user() managers in tests instead of hardcoding sha1 hashes

Reported by: Tim Graham Owned by: Tim Graham
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no


In 39a7eed1bbf12020a077e4bec3d82e08f171a021, some test fixtures were converted to use the ORM. This was a good step, but we still have hardcoded sha1 hashes which aren't friendly to reverse if you actually need the user's password.

Also, the fixtures were converted programmatically and some fields from the fixtures aren't need in the ORM versions (such as is_active=True since that's the default).

Most usage of self.client.login(**credentials) should be converted to self.client.force_login(user).

I attached a patch to get you started.

Please check the selenium tests too.

Attachments (1)

26175.diff (51.1 KB) - added by Tim Graham 5 years ago.

Download all attachments as: .zip

Change History (3)

Changed 5 years ago by Tim Graham

Attachment: 26175.diff added

comment:1 Changed 5 years ago by Tim Graham

Owner: changed from nobody to Tim Graham
Status: newassigned

comment:2 Changed 5 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 015fad9:

Fixed #26175 -- Removed SHA1 password hashes in tests.

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