diff --git a/tests/ldap/test_ldap_api.py b/tests/ldap/test_ldap_api.py index 51c3af01..d159ddcb 100644 --- a/tests/ldap/test_ldap_api.py +++ b/tests/ldap/test_ldap_api.py @@ -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)