Пример #1
0
    def test_LoginPortal_allMethods(self):

        newToken1 = "myToken1"
        newToken2 = "myToken2"

        token1 = LoginPortal.login(Authentication_loginName,
                                   Authentication_loginPassword)
        token2 = LoginPortal.getToken()
        token3 = LoginPortal.getKeystoneToken()
        user = LoginPortal.getKeystoneUserWithToken(token1)
        iden = LoginPortal.identArgIdentifier()

        self.assertEqual(iden, "--ident=")

        self.assertNotEqual(token1, "")
        self.assertIsNot(token1, None)
        self.assertEqual(token1, token2)
        self.assertEqual(token1, token3)

        self.assertIsNot(user.userName, None)
        self.assertNotEqual(user.userName, "")
        self.assertIsNot(user.id, None)
        self.assertNotEqual(user.id, "")

        LoginPortal.setKeystoneToken(newToken1)
        self.assertEqual(newToken1, LoginPortal.getKeystoneToken())
def testLoginPortal(user,password):
    token= LoginPortal.login(user,password)
    print("token=",token)
    user= LoginPortal.getKeystoneUserWithToken(token)
    print("user=",user.id,user.userName)
    return token
# *******************************************************************************************************
# LoginPortal section:
# *******************************************************************************************************


# In[ ]:

#help(LoginPortal)


# In[ ]:

#logging in and getting current token from different ways

token1 = LoginPortal.login(Authentication_loginName, Authentication_loginPassword);
token2 = LoginPortal.getToken()
token3 = LoginPortal.getKeystoneToken()
print("token1=" + token1)#
print("token2=" + token2)#
print("token3=" + token3)#


# In[ ]:

#getting curent user info

user = LoginPortal.getKeystoneUserWithToken(token1)
print("userName="******"id=" + user.id)#
iden = LoginPortal.identArgIdentifier()