2871: add tests for get_n_objects_of_class helper method
[arvados.git] / apps / workbench / test / functional / users_controller_test.rb
index c67c56b5c7edf6631f2c093e343d40e4f66affc3..8b026cb14f0dee989dd750bbac644a4191e90fa6 100644 (file)
@@ -1,4 +1,25 @@
 require 'test_helper'
 
 class UsersControllerTest < ActionController::TestCase
+  test "valid token works in functional test" do
+    get :index, {}, session_for(:active)
+    assert_response :success
+  end
+
+  test "ignore previously valid token (for deleted user), don't crash" do
+    get :welcome, {}, session_for(:valid_token_deleted_user)
+    assert_response :success
+    assert_nil assigns(:my_jobs)
+    assert_nil assigns(:my_ssh_keys)
+  end
+
+  test "expired token redirects to api server login" do
+    get :show, {
+      id: api_fixture('users')['active']['uuid']
+    }, session_for(:expired_trustedclient)
+    assert_response :redirect
+    assert_match /^#{Rails.configuration.arvados_login_base}/, @response.redirect_url
+    assert_nil assigns(:my_jobs)
+    assert_nil assigns(:my_ssh_keys)
+  end
 end