improve unit tests
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 31 May 2010 16:12:33 +0000 (16:12 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 31 May 2010 16:12:33 +0000 (16:12 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@892 e071eeec-0327-468d-9b6a-08194a12b294

examples/tests.py

index 9755752da3c04cf384a812630e6ad04169266e52..bca180294e5a8f038a176561aaac6886df88e2d5 100644 (file)
@@ -83,10 +83,14 @@ class GroupTestCase(BaseTestCase):
 
     def test_update(self):
         g = LdapGroup.objects.get(name='foogroup')
+
+        g.gid = 1002
+        g.usernames = ['foouser2', 'baruser2']
+        g.save()
+
+        # make sure DN gets updated if we change the pk
         g.name = 'foogroup2'
         g.save()
-        
-        # make sure DN gets updated
         self.assertEquals(g.dn, 'cn=foogroup2,ou=groups,dc=nodomain')
 
     def test_delete(self):
@@ -126,6 +130,16 @@ class UserTestCase(BaseTestCase):
 
         self.assertRaises(LdapUser.DoesNotExist, LdapUser.objects.get, username='does_not_exist')
 
+    def test_update(self):
+        u = LdapUser.objects.get(username='foouser')
+        u.first_name = u'Fôo2'
+        u.save()
+        
+        # make sure DN gets updated if we change the pk
+        u.username = 'foouser2'
+        u.save()
+        self.assertEquals(u.dn, 'uid=foouser2,ou=people,dc=nodomain')
+
 class AdminTestCase(BaseTestCase):
     fixtures = ['test_users.json']