def test_search_users(self): """ Test the user search by uid in ldap """ print_ln('test search users by uid') try: usr = User(uid = "jts*") uList = userdao.search(usr) for idx, entity in enumerate(uList) : print_user(entity, "User[" + str(idx+1) + "]:") except Exception as e: self.fail('user search failed, exception=' + str(e))
def find_users(user): """ Return a list of type User of all users in the people container that match all or part of the User.userId field passed in User entity. required parameters: user.uid - maps to existing user, can be partial with wildcard on end - * optional parameters: user.ou - maps to attribute assignment, can be partial with wildcard on end - *. """ utils.validate_user(user) return userdao.search(user)
def test_delete_users(self): """ Test the user delete """ print_ln('test delete users') try: uList = userdao.search(User(uid='py-test*')) for usr in uList: entity = userdao.delete(usr) print_ln("Delete user=" + entity.uid) except Exception as e: self.fail('user delete failed, exception=' + str(e))
def test_bind_users_negative(self): """ Test the user bind """ print_ln('test bind users') try: usr = User(uid = "jtsuser*") uList = userdao.search(usr) for idx, entity in enumerate(uList) : entity.password = '******' try: userdao.authenticate(entity) self.fail('test bind negative failed ' + entity.uid) except InvalidCredentials: pass except Exception as e: self.fail('user bind failed, exception=' + str(e))
def test_bind_users(self): """ Test the user bind """ print_ln('test bind users') try: usr = User(uid = "jtsuser*") uList = userdao.search(usr) for idx, entity in enumerate(uList) : entity.password = '******' + str(idx+1) try: userdao.authenticate(entity) except InvalidCredentials as e: print_ln(str(e)) #self.fail('user bind invalid creds, user='******'user bind exception=' + str(e))