CLOUDSTACK-3610: Fix regression test "test_accounts.TestUserLogin"

Now password is sent as clear text as per CLOUDSTACK-1734
So changed marvin to handle this. Plus domainid was not
passed in the testcase and marvin used "domainid" instead of
"domainId" as a parameter. Fixed these two errors.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit dba09791fc99c342974d8ca1c69609c04f1a5512)
This commit is contained in:
Girish Shilamkar 2013-07-22 19:13:11 +05:30 committed by Prasanna Santhanam
parent 95e1f6324f
commit 18fbbcfc5a
2 changed files with 5 additions and 12 deletions

View File

@ -1559,9 +1559,8 @@ class TestUserLogin(cloudstackTestCase):
respose = User.login( respose = User.login(
self.apiclient, self.apiclient,
username=self.account.name, username=self.account.name,
password=self.services["account"]["password"] password=self.services["account"]["password"],
) domainid=domain.id)
self.assertEqual(respose, None, "Login response should not be none")
self.debug("Login API response: %s" % respose) self.debug("Login API response: %s" % respose)
self.assertNotEqual( self.assertNotEqual(

View File

@ -148,10 +148,7 @@ class User:
if "userUUID" in services: if "userUUID" in services:
cmd.userid = "-".join([services["userUUID"],random_gen()]) cmd.userid = "-".join([services["userUUID"],random_gen()])
# Password Encoding cmd.password = services["password"]
mdf = hashlib.md5()
mdf.update(services["password"])
cmd.password = mdf.hexdigest()
cmd.username = "-".join([services["username"], random_gen()]) cmd.username = "-".join([services["username"], random_gen()])
user = apiclient.createUser(cmd) user = apiclient.createUser(cmd)
@ -201,14 +198,11 @@ class User:
cmd = login.loginCmd() cmd = login.loginCmd()
cmd.username = username cmd.username = username
# MD5 hashcoded password cmd.password = password
mdf = hashlib.md5()
mdf.update(password)
cmd.password = mdf.hexdigest()
if domain: if domain:
cmd.domain = domain cmd.domain = domain
if domainid: if domainid:
cmd.domainid = domainid cmd.domainId = domainid
return apiclient.login(cmd) return apiclient.login(cmd)