test admin interface search
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 31 May 2010 18:00:08 +0000 (18:00 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 31 May 2010 18:00:08 +0000 (18:00 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@900 e071eeec-0327-468d-9b6a-08194a12b294

examples/admin.py
examples/tests.py

index 8948bbc..8b33ecb 100644 (file)
@@ -23,6 +23,7 @@ from examples.models import LdapGroup, LdapUser
 
 class LdapGroupAdmin(admin.ModelAdmin):
     exclude = ['dn', 'usernames']
+    search_fields = ['name']
 
 class LdapUserAdmin(admin.ModelAdmin):
     exclude = ['dn', 'password', 'photo']
index f98fbdf..08d85b7 100644 (file)
@@ -162,6 +162,12 @@ class AdminTestCase(BaseTestCase):
         g.usernames = ['foouser', 'baruser']
         g.save()
 
+        g = LdapGroup()
+        g.name = "bargroup"
+        g.gid = 1001
+        g.usernames = ['zoouser', 'baruser']
+        g.save()
+
         u = LdapUser()
         u.first_name = "Foo"
         u.last_name = "User"
@@ -189,6 +195,10 @@ class AdminTestCase(BaseTestCase):
         self.assertContains(response, "foogroup")
         self.assertContains(response, "1000")
 
+    def test_group_search(self):
+        response = self.client.get('/admin/examples/ldapgroup/?q=foo')
+        self.assertContains(response, "foogroup")
+
     def test_user_list(self):
         response = self.client.get('/admin/examples/ldapuser/')
         self.assertContains(response, "Ldap users")