summaryrefslogtreecommitdiff
path: root/users/test/integration/api/account_flow_test.rb
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2013-08-22 11:44:47 -0700
committerjessib <jessib@riseup.net>2013-08-22 11:44:47 -0700
commit691dbff9dde60fb757810974ee4df2aa6fa48b58 (patch)
treeeeab4bbf69767b1aaa3ca7699fc23cf2aa7af971 /users/test/integration/api/account_flow_test.rb
parent8c45a3c54f2b0b709ebf040de0db00b6913e709b (diff)
parent76bc9d708b119d8c5047b487ccedaa9c70fec78b (diff)
Merge pull request #69 from azul/bugfix/update_user_password_through_api
Test updating user password through api
Diffstat (limited to 'users/test/integration/api/account_flow_test.rb')
-rw-r--r--users/test/integration/api/account_flow_test.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb
index ec7753c..507f0b9 100644
--- a/users/test/integration/api/account_flow_test.rb
+++ b/users/test/integration/api/account_flow_test.rb
@@ -5,6 +5,7 @@ class AccountFlowTest < RackTest
setup do
@login = "integration_test_user"
+ Identity.find_by_address(@login + '@' + APP_CONFIG[:domain]).tap{|i| i.destroy if i}
User.find_by_login(@login).tap{|u| u.destroy if u}
@password = "srp, verify me!"
@srp = SRP::Client.new @login, :password => @password
@@ -18,7 +19,7 @@ class AccountFlowTest < RackTest
end
teardown do
- if @user
+ if @user.reload
@user.identity.destroy
@user.destroy
end
@@ -77,6 +78,25 @@ class AccountFlowTest < RackTest
assert_nil server_auth
end
+ test "update password via api" do
+ @srp.authenticate(self)
+ @password = "No! Verify me instead."
+ @srp = SRP::Client.new @login, :password => @password
+ @user_params = {
+ # :login => @login,
+ :password_verifier => @srp.verifier.to_s(16),
+ :password_salt => @srp.salt.to_s(16)
+ }
+ puts @user_params.inspect
+ put "http://api.lvh.me:3000/1/users/" + @user.id + '.json',
+ :user => @user_params,
+ :format => :json
+ server_auth = @srp.authenticate(self)
+ assert last_response.successful?
+ assert_nil server_auth["errors"]
+ assert server_auth["M2"]
+ end
+
test "update user" do
server_auth = @srp.authenticate(self)
test_public_key = 'asdlfkjslfdkjasd'