- post "/login", :username => user.email, :password => "wrong", :referer => "/history"
- assert_response :redirect
- follow_redirect!
- assert_response :success
- assert_template "login"
+ assert_template "sessions/new"
+ assert_select "span.username", false
+ assert_select "div.flash.error", /your account has been suspended/ do
+ assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster"
+ end
+ end
+
+ def test_login_username_password_suspended_downcase
+ user = create(:user, :suspended)
+
+ try_password_login user.display_name.downcase, "test"
+
+ assert_template "sessions/new"
+ assert_select "span.username", false
+ assert_select "div.flash.error", /your account has been suspended/ do
+ assert_select "a[href='mailto:openstreetmap@example.com']", "webmaster"
+ end
+ end
+
+ def test_login_username_password_blocked
+ user = create(:user)
+ create(:user_block, :needs_view, :user => user)
+
+ try_password_login user.display_name.upcase, "test"