Created
April 3, 2017 20:28
-
-
Save grahamu/ed3db50dc2ae85f7ca71a724775e6452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CourseAdminLdap(MGHMockLdapMixin, MGHTestCase): | |
def setUp(self): | |
self._create_org_and_users() | |
self.test_course = self._create_course() | |
self.cv = self._create_course_version() | |
super(CourseAdminLdap, self).setUp() | |
def test_trainee_user_search(self): | |
""" | |
Test that view returns Sterling Archer from mockldap. | |
""" | |
self.ldapobj.search_s.seed( | |
settings.AUTH_LDAP_BASE_DN, | |
ldap.SCOPE_SUBTREE, | |
"(&(objectClass=phsPerson)(|(cn=Ster*)(sn=Ster*)))", | |
["cn", "sn", "givenName", "mail", "phsDepartmentName", "phsInstitution"] | |
)([self.archer]) | |
ci = self._create_course_instance() | |
with self.settings(AUTH_LDAP_BIND_DN='', AUTH_LDAP_BIND_PASSWORD=''): | |
with self.login(self.org_admin): | |
response = self.get( | |
"trainee_user_search_autocomplete", | |
pk=ci.pk, | |
data={"q": "Ster"} | |
) | |
self.response_200() | |
json_data = response.json() | |
self.assertEqual(json_data["options"][0]["value"], "Sterling Archer") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment