summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/nagios/soledad_sync.py2
-rwxr-xr-xtest/nagios/webapp_login.py19
2 files changed, 6 insertions, 15 deletions
diff --git a/test/nagios/soledad_sync.py b/test/nagios/soledad_sync.py
index 94679b1..faf552a 100755
--- a/test/nagios/soledad_sync.py
+++ b/test/nagios/soledad_sync.py
@@ -52,7 +52,7 @@ def get_soledad_info(config, tempdir):
api = config['api']
usr = srp.User( user['username'], user['password'], srp.SHA256, srp.NG_1024 )
try:
- auth = webapp_login.parse(webapp_login.authenticate(api, usr))
+ auth = webapp_login.authenticate(api, usr)
except requests.exceptions.ConnectionError:
fail('no connection to server')
# get soledad server url
diff --git a/test/nagios/webapp_login.py b/test/nagios/webapp_login.py
index 1711238..86a4045 100755
--- a/test/nagios/webapp_login.py
+++ b/test/nagios/webapp_login.py
@@ -33,21 +33,11 @@ def run_tests(config):
api = config['api']
usr = srp.User(user['username'], user['password'], srp.SHA256, srp.NG_1024)
try:
- auth = parse(authenticate(api, usr))
+ auth = authenticate(api, usr)
except requests.exceptions.ConnectionError:
fail('no connection to server')
exit(report(auth, usr))
-# parse the server responses
-
-
-def parse(response):
- request = response.request
- try:
- return json.loads(response.text)
- except ValueError:
- return None
-
def authenticate(api, usr):
api_url = "https://{domain}:{port}/{version}".format(**api)
@@ -57,14 +47,15 @@ def authenticate(api, usr):
'login': uname,
'A': binascii.hexlify(A)
}
- init = parse(
- session.post(api_url + '/sessions', data=params, verify=False))
+ response = session.post(api_url + '/sessions', data=params, verify=False)
+ init = response.json()
if ('errors' in init):
fail('test user not found')
M = usr.process_challenge(
safe_unhexlify(init['salt']), safe_unhexlify(init['B']))
- return session.put(api_url + '/sessions/' + uname, verify=False,
+ response = session.put(api_url + '/sessions/' + uname, verify=False,
data={'client_auth': binascii.hexlify(M)})
+ return response.json()
def report(auth, usr):