diff options
author | Azul <azul@leap.se> | 2012-10-05 13:59:39 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2012-10-05 13:59:39 +0200 |
commit | 118d9ab5c9f4d7a82b7cf24774ef12d3c221f8ef (patch) | |
tree | 0f698522a1beaaab6993cc5d2160c3d69ab2a19f /users/test/integration | |
parent | f7e832b111b38c1b2bdef45ab74001590b17c0dc (diff) |
moving to ruby_srp 0.1.0, works with python srp
Diffstat (limited to 'users/test/integration')
-rwxr-xr-x | users/test/integration/api/python/flow_with_srp.py | 2 | ||||
-rwxr-xr-x | users/test/integration/api/python/signup_and_login.py | 10 |
2 files changed, 4 insertions, 8 deletions
diff --git a/users/test/integration/api/python/flow_with_srp.py b/users/test/integration/api/python/flow_with_srp.py index 08ac94a..ea630f2 100755 --- a/users/test/integration/api/python/flow_with_srp.py +++ b/users/test/integration/api/python/flow_with_srp.py @@ -52,7 +52,7 @@ user = print_and_parse(signup(session)) # SRP signup would happen here and calculate M hex auth = print_and_parse(authenticate(session, user['login'])) -usr.verify_session( auth ) +usr.verify_session( binascii.unhexlify(auth["M2"]) ) # At this point the authentication process is complete. assert usr.authenticated() diff --git a/users/test/integration/api/python/signup_and_login.py b/users/test/integration/api/python/signup_and_login.py index 2d79688..ac611d7 100755 --- a/users/test/integration/api/python/signup_and_login.py +++ b/users/test/integration/api/python/signup_and_login.py @@ -20,14 +20,13 @@ def print_and_parse(response): print response.request.method + ': ' + response.url print " " + json.dumps(response.request.data) print " -> " + response.text - print " () " + json.dumps(requests.utils.dict_from_cookiejar(response.cookies)) return json.loads(response.text) def signup(session): user_params = { 'user[login]': id_generator(), 'user[password_verifier]': '12345', - 'user[password_salt]': '54321' + 'user[password_salt]': 'AB54321' } return session.post(server + '/users.json', data = user_params) @@ -36,11 +35,8 @@ def authenticate(session, login): 'login': login, 'A': '12345', } - init = session.post(server + '/sessions', data = params) - cookies = requests.utils.dict_from_cookiejar(init.cookies) - init = session.post(server + '/sessions', data = params, cookies = cookies) - print "(%) " + json.dumps(cookies) - return session.put(server + '/sessions/' + login, data = {'client_auth': '123'}, cookies = cookies) + init = print_and_parse(session.post(server + '/sessions', data = params)) + return session.put(server + '/sessions/' + login, data = {'client_auth': '123'}) session = requests.session() user = print_and_parse(signup(session)) |