Code Review
/
integration
/
test.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Fix netconf entity name creation during lookup
[integration/test.git]
/
csit
/
libraries
/
AuthStandalone.py
diff --git
a/csit/libraries/AuthStandalone.py
b/csit/libraries/AuthStandalone.py
index 2435423bcecc7317974369fd6c39a4c3436f8ab5..5cb840a4f9054b38e7fc23a12d9cddac7140fd63 100644
(file)
--- a/
csit/libraries/AuthStandalone.py
+++ b/
csit/libraries/AuthStandalone.py
@@
-92,7
+92,9
@@
class _BasicReusingSession(object):
if username:
self.session.auth = (username, password) # May work with non-string values
else:
if username:
self.session.auth = (username, password) # May work with non-string values
else:
- self.session.auth = None # Supports "no authentication mode" as in odl-restconf-noauth
+ self.session.auth = (
+ None # Supports "no authentication mode" as in odl-restconf-noauth
+ )
def robust_method(self, method, uri, **kwargs):
"""Try method once using session credentials. Return last response."""
def robust_method(self, method, uri, **kwargs):
"""Try method once using session credentials. Return last response."""
@@
-109,7
+111,9
@@
class _BasicClosingSession(object):
if username:
self.auth = (username, password) # May work with non-string values
else:
if username:
self.auth = (username, password) # May work with non-string values
else:
- self.auth = None # Supports "no authentication mode" as in odl-restconf-noauth
+ self.auth = (
+ None # Supports "no authentication mode" as in odl-restconf-noauth
+ )
self.session = None
def robust_method(self, method, uri, **kwargs):
self.session = None
def robust_method(self, method, uri, **kwargs):
@@
-144,7
+148,9
@@
class _TokenReusingSession(object):
if self.session:
self.session.close()
self.session = requests.Session()
if self.session:
self.session.close()
self.session = requests.Session()
- resp = self.session.post(self.auth_url, data=self.auth_data, headers=self.auth_header)
+ resp = self.session.post(
+ self.auth_url, data=self.auth_data, headers=self.auth_header
+ )
resp_obj = json.loads(resp.text)
try:
token = resp_obj["access_token"]
resp_obj = json.loads(resp.text)
try:
token = resp_obj["access_token"]
@@
-152,7
+158,6
@@
class _TokenReusingSession(object):
raise RuntimeError("Parse failed: " + resp.text)
self.token = token
# TODO: Use logging so that callers could see token refreshes.
raise RuntimeError("Parse failed: " + resp.text)
self.token = token
# TODO: Use logging so that callers could see token refreshes.
- # print "DEBUG: token:", token
# We keep self.session to use for the following restconf requests.
def oneshot_method(self, method, uri, **kwargs):
# We keep self.session to use for the following restconf requests.
def oneshot_method(self, method, uri, **kwargs):
@@
-192,7
+197,9
@@
class _TokenClosingSession(object):
if self.session:
self.session.close()
self.session = requests.Session()
if self.session:
self.session.close()
self.session = requests.Session()
- resp = self.session.post(self.auth_url, data=self.auth_data, headers=self.auth_header)
+ resp = self.session.post(
+ self.auth_url, data=self.auth_data, headers=self.auth_header
+ )
resp_obj = json.loads(resp.text)
try:
token = resp_obj["access_token"]
resp_obj = json.loads(resp.text)
try:
token = resp_obj["access_token"]
@@
-200,7
+207,6
@@
class _TokenClosingSession(object):
raise RuntimeError("Parse failed: " + resp.text)
self.token = token
# TODO: Use logging so that callers could see token refreshes.
raise RuntimeError("Parse failed: " + resp.text)
self.token = token
# TODO: Use logging so that callers could see token refreshes.
- # print "DEBUG: token:", token
# We keep self.session to use for the following restconf requests.
def oneshot_method(self, method, uri, **kwargs):
# We keep self.session to use for the following restconf requests.
def oneshot_method(self, method, uri, **kwargs):