From b3c58ba4f16c772b0ad232aedf41a4add02b1440 Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 31 May 2010 14:21:56 +0000 Subject: [PATCH] improve admin interface tests git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@889 e071eeec-0327-468d-9b6a-08194a12b294 --- examples/tests.py | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/examples/tests.py b/examples/tests.py index 074d389..dd3312f 100644 --- a/examples/tests.py +++ b/examples/tests.py @@ -90,18 +90,48 @@ class UserTestCase(BaseTestCase): class AdminTestCase(BaseTestCase): fixtures = ['test_users.json'] - def test_index(self): + def setUp(self): + super(AdminTestCase, self).setUp() + + g = LdapGroup() + g.name = "foogroup" + g.gid = 1000 + g.usernames = ['foouser', 'baruser'] + g.save() + + u = LdapUser() + u.first_name = "Foo" + u.last_name = "User" + u.full_name = "Foo User" + u.group = 1000 + u.home_directory = "/home/foouser" + u.uid = 1000 + u.username = "foouser" + u.save() + self.client.login(username="test_user", password="password") + + def test_index(self): response = self.client.get('/admin/examples/') self.assertContains(response, "Ldap groups") self.assertContains(response, "Ldap users") - def test_list_groups(self): - self.client.login(username="test_user", password="password") + def test_group_list(self): response = self.client.get('/admin/examples/ldapgroup/') self.assertContains(response, "Ldap groups") + self.assertContains(response, "foogroup") - def test_list_users(self): - self.client.login(username="test_user", password="password") + def test_group_detail(self): + response = self.client.get('/admin/examples/ldapgroup/foogroup/') + self.assertContains(response, "foogroup") + self.assertContains(response, "1000") + + def test_user_list(self): response = self.client.get('/admin/examples/ldapuser/') self.assertContains(response, "Ldap users") + self.assertContains(response, "foouser") + + def test_user_detail(self): + response = self.client.get('/admin/examples/ldapuser/foouser/') + self.assertContains(response, "foouser") + self.assertContains(response, "1000") -- 2.30.2