From 59f6aaa70d7a7fca741ba4849b2d0604db32bbdc Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 31 May 2010 18:00:08 +0000 Subject: [PATCH] test admin interface search git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@900 e071eeec-0327-468d-9b6a-08194a12b294 --- examples/admin.py | 1 + examples/tests.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/examples/admin.py b/examples/admin.py index 8948bbc..8b33ecb 100644 --- a/examples/admin.py +++ b/examples/admin.py @@ -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'] diff --git a/examples/tests.py b/examples/tests.py index f98fbdf..08d85b7 100644 --- a/examples/tests.py +++ b/examples/tests.py @@ -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") -- 2.30.2