summaryrefslogtreecommitdiff
path: root/users/test/integration/api/login_test.rb
diff options
context:
space:
mode:
authorazul <azul@riseup.net>2014-04-17 10:12:05 +0200
committerazul <azul@riseup.net>2014-04-17 10:12:05 +0200
commit3513ad74f950b113af1ba1e3d06bc6a55c48fde5 (patch)
treedb49ebd4428053d5c8d720275b77594a531a1ad1 /users/test/integration/api/login_test.rb
parentcb6442c344d6bdaf52c3878b2de2fcf4d85f2648 (diff)
parent3d3688647fab7049e5b531c45b85c1e46a1d528f (diff)
Merge pull request #146 from azul/refactor/engines
Refactor/engines
Diffstat (limited to 'users/test/integration/api/login_test.rb')
-rw-r--r--users/test/integration/api/login_test.rb50
1 files changed, 0 insertions, 50 deletions
diff --git a/users/test/integration/api/login_test.rb b/users/test/integration/api/login_test.rb
deleted file mode 100644
index 92d153f..0000000
--- a/users/test/integration/api/login_test.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-require 'test_helper'
-require_relative 'srp_test'
-
-class LoginTest < SrpTest
-
- setup do
- register_user
- end
-
- test "requires handshake before validation" do
- validate("bla")
- assert_json_error login: I18n.t(:all_strategies_failed)
- end
-
- test "login with srp" do
- authenticate
- assert_equal ["M2", "id", "token"], server_auth.keys
- assert last_response.successful?
- assert_nil server_auth["errors"]
- assert server_auth["M2"]
- end
-
- test "wrong password login attempt" do
- authenticate password: "wrong password"
- assert_json_error "base" => "Not a valid username/password combination"
- assert !last_response.successful?
- assert_nil server_auth["M2"]
- end
-
- test "wrong username login attempt" do
- assert_raises RECORD_NOT_FOUND do
- authenticate login: "wrong login"
- end
- assert_json_error "base" => "Not a valid username/password combination"
- assert !last_response.successful?
- assert_nil server_auth
- end
-
- test "logout" do
- authenticate
- logout
- assert_equal 204, last_response.status
- end
-
- test "logout requires token" do
- authenticate
- logout(nil, {})
- assert_equal 422, last_response.status
- end
-end