Changeset 446 in main


Ignore:
Timestamp:
11/03/11 14:05:11 (8 years ago)
Author:
pcosquer
Message:

user: test password modification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/openPLM/plmapp/tests/views.py

    r445 r446  
    488488        self.assertEqual("Snow", user.last_name) 
    489489 
     490    def test_password_get(self): 
     491        response = self.client.get(self.user_url + "password/") 
     492        self.assertEqual(response.status_code,  200) 
     493        self.assertTrue(response.context["modification_form"]) 
     494 
     495    def test_password_post(self): 
     496        data = dict(old_password="password", new_password1="pw", 
     497                new_password2="pw") 
     498        response = self.client.post(self.user_url + "password/", data, follow=True) 
     499        self.assertEqual(response.status_code,  200) 
     500        self.user = User.objects.get(pk=self.user.pk) 
     501        self.assertTrue(self.user.check_password("pw")) 
     502 
     503    def test_password_error(self): 
     504        data = dict(old_password="error", new_password1="pw", 
     505                new_password2="pw") 
     506        response = self.client.post(self.user_url + "password/", data, follow=True) 
     507        self.user = User.objects.get(pk=self.user.pk) 
     508        self.assertTrue(self.user.check_password("password")) 
     509        self.assertFalse(self.user.check_password("pw")) 
     510 
     511 
    490512from django.core.management import call_command 
    491513class SearchViewTest(CommonViewTest): 
Note: See TracChangeset for help on using the changeset viewer.