improve unit tests
[matthijs/upstream/django-ldapdb.git] / 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']