diff options
author | jessib <jessib@riseup.net> | 2012-10-11 09:47:12 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2012-10-11 09:47:12 -0700 |
commit | 336d5f786bbd1aaf1847007db64e55f96e585b9d (patch) | |
tree | 0a18244ba8d21ed821c52edb2d44544b5358aa26 /users/test/integration/api | |
parent | cf9ed38ab1840092352efdbb71bfeb5bc3b9f9d5 (diff) | |
parent | 09003d3d2df7c250d3a0b55e83094e5e27094859 (diff) |
Merge branch 'develop' into help_develop
Conflicts:
.gitignore
Diffstat (limited to 'users/test/integration/api')
-rw-r--r-- | users/test/integration/api/account_flow_test.rb | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb index e20bcf6..66de1e5 100644 --- a/users/test/integration/api/account_flow_test.rb +++ b/users/test/integration/api/account_flow_test.rb @@ -30,40 +30,39 @@ class AccountFlowTest < ActionDispatch::IntegrationTest :password_verifier => @srp.verifier.to_s(16), :password_salt => @srp.salt.to_s(16) } + post '/users.json', :user => @user_params + @user = User.find_by_param(@login) end def teardown @user.destroy if @user # make sure we can run this test again end - test "signup and login with srp via api" do - post '/users.json', :user => @user_params - @user = User.find_by_param(@login) + test "signup response" do assert_json_response @user_params.slice(:login, :password_salt) assert_response :success - server_auth = @srp.authenticate(self, @login, @password) + end + + test "signup and login with srp via api" do + server_auth = @srp.authenticate(self) assert_nil server_auth["errors"] assert server_auth["M2"] end test "signup and wrong password login attempt" do - post '/users.json', :user => @user_params - @user = User.find_by_param(@login) - assert_json_response @user_params.slice(:login, :password_salt) - assert_response :success - server_auth = @srp.authenticate(self, @login, "wrong password") + srp = SRP::Client.new(@login, "wrong password") + server_auth = srp.authenticate(self) assert_equal ["wrong password"], server_auth["errors"]['password'] assert_nil server_auth["M2"] end test "signup and wrong username login attempt" do - post '/users.json', :user => @user_params - @user = User.find_by_param(@login) - assert_json_response @user_params.slice(:login, :password_salt) - assert_response :success + srp = SRP::Client.new("wrong_login", @password) + server_auth = nil assert_raises RECORD_NOT_FOUND do - server_auth = @srp.authenticate(self, "wronglogin", @password) + server_auth = srp.authenticate(self) end + assert_nil server_auth end end |