add test cases for qs.values(*fields) and qs.values_list(*fields)
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Tue, 1 Jun 2010 12:37:45 +0000 (12:37 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Tue, 1 Jun 2010 12:37:45 +0000 (12:37 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@915 e071eeec-0327-468d-9b6a-08194a12b294

examples/tests.py

index f99ea2e..d41d576 100644 (file)
@@ -169,6 +169,20 @@ class GroupTestCase(BaseTestCase):
         g.save()
         self.assertEquals(g.dn, 'cn=foogroup2,ou=groups,dc=nodomain')
 
+    def test_values(self):
+        qs = LdapGroup.objects.values('name')
+        self.assertEquals(len(qs), 3)
+        self.assertEquals(qs[0], {'name': 'foogroup'})
+        self.assertEquals(qs[1], {'name': 'bargroup'})
+        self.assertEquals(qs[2], {'name': 'wizgroup'})
+
+    def test_values_list(self):
+        qs = LdapGroup.objects.values_list('name')
+        self.assertEquals(len(qs), 3)
+        self.assertEquals(qs[0], ('foogroup',))
+        self.assertEquals(qs[1], ('bargroup',))
+        self.assertEquals(qs[2], ('wizgroup',))
+
     def test_delete(self):
         g = LdapGroup.objects.get(name='foogroup')
         g.delete()