test that you can't be someone not in ldap
This commit is contained in:
parent
024a63b725
commit
cd889c5b67
|
@ -7,7 +7,7 @@ class TestLdapApi(BaseTest):
|
|||
|
||||
def test_get_ldap(self):
|
||||
"""
|
||||
Test to make sure that LDAP api point returns a 200 code
|
||||
Test to make sure that LDAP api returns a real user
|
||||
"""
|
||||
self.load_example_data()
|
||||
rv = self.app.get('/v1.0/ldap?query=dhf',
|
||||
|
@ -21,5 +21,18 @@ class TestLdapApi(BaseTest):
|
|||
self.assertEqual(data[0]['given_name'], 'Dan')
|
||||
self.assertEqual(data[0]['affiliation'], 'faculty')
|
||||
|
||||
def test_not_in_ldap(self):
|
||||
"""
|
||||
Test to make sure the LDAP api doesn't return a nonexistent user
|
||||
"""
|
||||
self.load_example_data()
|
||||
rv = self.app.get('/v1.0/ldap?query=atp',
|
||||
follow_redirects=True,
|
||||
content_type="application/json", headers=self.logged_in_headers())
|
||||
# Should still successfully perform lookup
|
||||
self.assertTrue(rv.status_code == 200)
|
||||
data = json.loads(rv.data)
|
||||
# Should not return any users
|
||||
self.assertEqual(len(data), 0)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue