Closed Bug 1461362 Opened 6 years ago Closed 4 years ago

creation of test users does not work

Categories

(Developer Documentation Graveyard :: Learning Area, enhancement, P3)

All
Other
enhancement

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: lukas.lu.mueller, Unassigned)

References

()

Details

:: Developer Documentation Request

      Request Type: Correction
     Gecko Version: unspecified
 Technical Contact: 

:: Details

Hi,

in the lower section where views are tested users are created in the code like this:
    def setUp(self):
        #Create two users
        test_user1 = User.objects.create_user(username='testuser1', password='12345') 
        test_user1.save()
        test_user2 = User.objects.create_user(username='testuser2', password='12345') 
        test_user2.save()
        
When using self.client.login with the credentials above, it will fail. After googleing around this is because in the create_user method the password hash is set to 12345.
Using 
test_user1.set_password('12345') after creating the object and before saving will fix this.

Kind regards
Component: Developer Tools → Learning Area
Priority: -- → P3
MDN Web Docs' bug reporting has now moved to GitHub. From now on, please file content bugs at https://github.com/mdn/sprints/issues/ and platform bugs at https://github.com/mdn/kuma/issues/.
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.