diff options
author | Azul <azul@leap.se> | 2013-04-02 16:56:11 +0200 |
---|---|---|
committer | Azul <azul@leap.se> | 2013-04-02 16:56:11 +0200 |
commit | d781dbdd61d1d24ec4828859a28815b55310154d (patch) | |
tree | 1e2deca8e62aa804b2babe38f9780089c88f38ff /users/test/integration | |
parent | 62c48c5a14ea0c1221216c3e40eb82ef594f2771 (diff) |
send more meaningful error message on completely failed login attempt
Diffstat (limited to 'users/test/integration')
-rw-r--r-- | users/test/integration/api/account_flow_test.rb | 6 | ||||
-rw-r--r-- | users/test/integration/api/login_test.rb | 25 |
2 files changed, 29 insertions, 2 deletions
diff --git a/users/test/integration/api/account_flow_test.rb b/users/test/integration/api/account_flow_test.rb index e618541..d1a97e9 100644 --- a/users/test/integration/api/account_flow_test.rb +++ b/users/test/integration/api/account_flow_test.rb @@ -75,7 +75,8 @@ class AccountFlowTest < ActiveSupport::TestCase test "signup and wrong password login attempt" do srp = SRP::Client.new @login, :password => "wrong password" server_auth = srp.authenticate(self) - assert_json_error({:login => "Not a valid username/password combination", :password => "Not a valid username/password combination"}) + assert_json_error login: "Not a valid username/password combination", + password: "Not a valid username/password combination" assert !last_response.successful? assert_nil server_auth["M2"] end @@ -86,7 +87,8 @@ class AccountFlowTest < ActiveSupport::TestCase assert_raises RECORD_NOT_FOUND do server_auth = srp.authenticate(self) end - assert_json_error({:login => "Not a valid username/password combination", :password => "Not a valid username/password combination"}) + assert_json_error login: "Not a valid username/password combination", + password: "Not a valid username/password combination" assert !last_response.successful? assert_nil server_auth end diff --git a/users/test/integration/api/login_test.rb b/users/test/integration/api/login_test.rb new file mode 100644 index 0000000..ba82c8e --- /dev/null +++ b/users/test/integration/api/login_test.rb @@ -0,0 +1,25 @@ +require 'test_helper' + +CONFIG_RU = (Rails.root + 'config.ru').to_s +OUTER_APP = Rack::Builder.parse_file(CONFIG_RU).first + +class AccountFlowTest < ActiveSupport::TestCase + include Rack::Test::Methods + include Warden::Test::Helpers + include LeapWebCore::AssertResponses + + def app + OUTER_APP + end + + def setup + @login = "integration_test_user" + end + + test "require json requests" do + put "http://api.lvh.me:3000/1/sessions/" + @login, + :client_auth => "This is not a valid login anyway" + assert_json_error login: I18n.t(:all_strategies_failed) + end + +end |