aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Chatzimichos <tampakrap@gentoo.org>2013-08-21 23:01:35 +0200
committerTheo Chatzimichos <tampakrap@gentoo.org>2013-08-23 16:37:51 +0200
commitfa2443419c0de3e822afc8d24701a22bbfcb8982 (patch)
treee32c66f0dbb1f56a6ec706ea050c64f07ddcf6a5 /okupy/tests/integration/test_lists.py
parentAdd support for negative queries in set_search_seed (diff)
downloadidentity.gentoo.org-fa2443419c0de3e822afc8d24701a22bbfcb8982.tar.gz
identity.gentoo.org-fa2443419c0de3e822afc8d24701a22bbfcb8982.tar.bz2
identity.gentoo.org-fa2443419c0de3e822afc8d24701a22bbfcb8982.zip
Add tests for the accounts lists
Diffstat (limited to 'okupy/tests/integration/test_lists.py')
-rw-r--r--okupy/tests/integration/test_lists.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/okupy/tests/integration/test_lists.py b/okupy/tests/integration/test_lists.py
new file mode 100644
index 0000000..1c854c2
--- /dev/null
+++ b/okupy/tests/integration/test_lists.py
@@ -0,0 +1,42 @@
+# vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
+
+from django.conf import settings
+from django.test import TestCase
+
+from django.test.client import Client
+
+from mockldap import MockLdap
+
+from .. import vars
+from ...common.test_helpers import ldap_users, set_search_seed
+
+class ListsIntegrationTests(TestCase):
+ @classmethod
+ def setUpClass(cls):
+ cls.mockldap = MockLdap(vars.DIRECTORY)
+
+ def setUp(self):
+ self.client = Client()
+ self.mockldap.start()
+ self.ldapobject = self.mockldap[settings.AUTH_LDAP_SERVER_URI]
+
+ def tearDown(self):
+ self.mockldap.stop()
+
+ def test_devlist_page_uses_correct_template(self):
+ self.ldapobject.search_s.seed(settings.AUTH_LDAP_USER_BASE_DN, 2, set_search_seed(attr='gentooACL', value='developer.group'))([ldap_users('alice'), ldap_users('jack')])
+ response = self.client.get('/devlist/')
+ self.assertTemplateUsed(response, 'base.html')
+ self.assertTemplateUsed(response, 'devlist.html')
+
+ def test_former_devlist_page_uses_correct_template(self):
+ self.ldapobject.search_s.seed(settings.AUTH_LDAP_USER_BASE_DN, 2, set_search_seed(attr='gentooACL', value='retired.group'))([ldap_users('john'), ldap_users('matt')])
+ response = self.client.get('/former-devlist/')
+ self.assertTemplateUsed(response, 'base.html')
+ self.assertTemplateUsed(response, 'former-devlist.html')
+
+ def test_foundation_members_page_uses_correct_template(self):
+ self.ldapobject.search_s.seed(settings.AUTH_LDAP_USER_BASE_DN, 2, set_search_seed(attr='gentooACL', value='foundation.group'))([ldap_users('bob'), ldap_users('jack')])
+ response = self.client.get('/foundation-members/')
+ self.assertTemplateUsed(response, 'base.html')
+ self.assertTemplateUsed(response, 'foundation-members.html')