Add ldap query counting to tests
This commit is contained in:
parent
a1671a3dd7
commit
bfc0bb42ad
1 changed files with 8 additions and 1 deletions
|
@ -162,7 +162,11 @@ class LongTermClipperTests(CASTestCase):
|
|||
'mailRoutingAddress' : ['test@clipper.ens.fr'],
|
||||
'homeDirectory': ["/users/%d/phy/test/" % promo],
|
||||
}
|
||||
|
||||
|
||||
def _count_ldap_queries(self):
|
||||
queries = _mock_ldap.ldap_methods_called()
|
||||
count = len([l for l in queries if l != 'set_option'])
|
||||
return count
|
||||
|
||||
def test_new_connexion(self):
|
||||
self._setup_ldap()
|
||||
|
@ -174,6 +178,7 @@ class LongTermClipperTests(CASTestCase):
|
|||
self.assertEqual(u.first_name, "John")
|
||||
self.assertEqual(u.last_name, "Smith")
|
||||
self.assertEqual(u.email, "test@clipper.ens.fr")
|
||||
self.assertEqual(self._count_ldap_queries(), 1)
|
||||
|
||||
sa = list(SocialAccount.objects.all())[-1]
|
||||
self.assertEqual(sa.user.id, u.id)
|
||||
|
@ -197,6 +202,7 @@ class LongTermClipperTests(CASTestCase):
|
|||
|
||||
self.client_cas_login(self.client, provider_id="clipper", username="test")
|
||||
self.assertEqual(User.objects.count(), nu)
|
||||
self.assertEqual(self._count_ldap_queries(), 1)
|
||||
|
||||
def test_deprecation(self):
|
||||
self._setup_ldap()
|
||||
|
@ -225,6 +231,7 @@ class LongTermClipperTests(CASTestCase):
|
|||
self.assertEqual(len(sa1), n_sa0)
|
||||
self.assertEqual(n_u1, n_u0)
|
||||
self.assertEqual(user1.id, user0.id)
|
||||
self.assertEqual(self._count_ldap_queries(), 2)
|
||||
|
||||
def test_override_inactive_account(self):
|
||||
self._setup_ldap(12)
|
||||
|
|
Loading…
Reference in a new issue