summaryrefslogtreecommitdiffstats
path: root/testapi
diff options
context:
space:
mode:
authorthuva4 <tharma.thuva@gmail.com>2018-03-08 13:56:20 +0530
committerthuva4 <tharma.thuva@gmail.com>2018-03-08 13:56:20 +0530
commita0b128a381aa3f97073779206ed67e03cc2b33fe (patch)
tree23e8825a612914e3e37b71900323890d527d3b98 /testapi
parentf3a5531761a38cf40d0469209145394b31af2088 (diff)
Do not need to check if user has existing session
We are currently checking no matter user has a session or not.Fix it. Current implemetation don't allow user to use existing session. Fix it. Change-Id: I5c1bf2bf9b3475f4723d7e136a60effd4287199d Signed-off-by: thuva4 <tharma.thuva@gmail.com>
Diffstat (limited to 'testapi')
-rw-r--r--testapi/testapi-client/testapiclient/identity.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/testapi/testapi-client/testapiclient/identity.py b/testapi/testapi-client/testapiclient/identity.py
index 03b3ac5..f38d8e1 100644
--- a/testapi/testapi-client/testapiclient/identity.py
+++ b/testapi/testapi-client/testapiclient/identity.py
@@ -17,19 +17,21 @@ def _authenticate(username, password):
'form_id': 'user_login'
}
response = session.post(hostname, data)
- user.User.session = session
+ if "login" not in response.text:
+ user.User.session = session
return response
def authenticate(xstep):
@functools.wraps(xstep)
def wrapper(self, parsed_args):
- username = parsed_args.u
- password = parsed_args.p
- if(username and password):
- response = _authenticate(username, password)
- if "login" in response.text:
- print "Authentication has failed."
- else:
- xstep(self, parsed_args)
+ if(user.User.session is None):
+ username = parsed_args.u
+ password = parsed_args.p
+ if(username and password):
+ response = _authenticate(username, password)
+ if "login" in response.text:
+ print "Authentication has failed."
+ return
+ xstep(self, parsed_args)
return wrapper