def test_check_password(self, initialize_mock): mockldap = MockLdapConn() initialize_mock.return_value = MockLdapConn.Connection(None, None, None, None) user = BmajUser('biomaj') user.create('test', '*****@*****.**') self.assertTrue(user.check_password('test')) user.remove()
def test_check_password(self, initialize_mock): mockldap = MockLdapConn() initialize_mock.return_value = MockLdapConn.Connection( None, None, None, None) user = BmajUser('biomaj') user.create('test', '*****@*****.**') self.assertTrue(user.check_password('test')) user.remove()
def test_ldap_user(self, initialize_mock): mockldap = MockLdapConn() initialize_mock.return_value = MockLdapConn.Connection(None, None, None, None) user = BmajUser('biomajldap') self.assertTrue(user.user['is_ldap'] == True) self.assertTrue(user.user['_id'] is not None) self.assertTrue(user.check_password('test')) user.remove()
def test_ldap_user(self, initialize_mock): mockldap = MockLdapConn() initialize_mock.return_value = MockLdapConn.Connection(None, None, None, None) user = BmajUser("biomajldap") self.assertTrue(user.user["is_ldap"] == True) self.assertTrue(user.user["_id"] is not None) self.assertTrue(user.check_password("test")) user.remove()
def test_ldap_user(self, initialize_mock): mockldap = MockLdapConn() initialize_mock.return_value = MockLdapConn.Connection( None, None, None, None) user = BmajUser('biomajldap') self.assertTrue(user.user['is_ldap'] == True) self.assertTrue(user.user['_id'] is not None) self.assertTrue(user.check_password('test')) user.remove()
def check_user_pw(username, password): """checks for plain password vs hashed password in database""" if not password or password == '': return None user = BmajUser(username) if not user: return False if user.check_password(password): return user.user else: return None