summaryrefslogtreecommitdiff
path: root/users/test/integration
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-08-21 07:30:36 +0200
committerAzul <azul@leap.se>2013-08-21 07:30:36 +0200
commit54243290c1550d88be0a39cdabeaf47a4a13075c (patch)
tree99c81fda56e227fa457bc04b0a853ea752dd02e9 /users/test/integration
parent115d96398246dcda23a51728dfafe1ea3c8ede88 (diff)
integration test updating users password
Diffstat (limited to 'users/test/integration')
-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'