2659: Do not turn on anonymous config by default in test mode; instead make the tests...
authorRadhika Chippada <radhika@curoverse.com>
Wed, 4 Feb 2015 14:22:05 +0000 (09:22 -0500)
committerRadhika Chippada <radhika@curoverse.com>
Wed, 4 Feb 2015 14:22:05 +0000 (09:22 -0500)
Also convert some of the simple integration tests into controller tests.

apps/workbench/config/application.default.yml
apps/workbench/test/controllers/projects_controller_test.rb
apps/workbench/test/integration/anonymous_access_test.rb
apps/workbench/test/integration/errors_test.rb

index ab81032e23f3ebb29129f0dd3a8ca15997899285..f43e8c6e098135cd3837c5c3a327e3fafafb3fe5 100644 (file)
@@ -120,7 +120,6 @@ test:
         - Software developer
         - IT
         - Other
-  anonymous_user_token: 4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi
 
 common:
   assets.js_compressor: false
index 5d7b1e27b3b46453fad4c32ddbdf2b4bba3400c7..c2089ad18d816cd47087270b603a655ab22e2dff 100644 (file)
@@ -207,4 +207,18 @@ class ProjectsControllerTest < ActionController::TestCase
                           }]
     get :show, encoded_params, session_for(:active)
   end
+
+  test "visit non-public project as anonymous when anonymous browsing is enabled and expect page not found" do
+    Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
+    get(:show, {id: api_fixture('groups')['aproject']['uuid']})
+    assert_response 404
+    assert_includes @response.inspect, 'you are not logged in'
+  end
+
+  test "visit home page as anonymous when anonymous browsing is enabled and expect login" do
+    Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
+    get(:index)
+    assert_response :redirect
+    assert_match /\/users\/welcome/, @response.redirect_url
+  end
 end
index 0a850188df6656c2afdc85e7d01e15b7ddb20ab8..2e6366215c5495657874e116d737f851b5f0cc24 100644 (file)
@@ -52,19 +52,6 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
     end
   end
 
-  test "visit non-public project as anonymous when anonymous browsing is enabled and expect page not found" do
-    visit "/projects/#{api_fixture('groups')['aproject']['uuid']}"
-    assert_text 'Not Found'
-  end
-
-  test "anonymous user clicking on topnav sees login page" do
-    visit PUBLIC_PROJECT
-
-    # click on topnav
-    click_link 'workbench:test'
-    assert_text 'Please log in'
-  end
-
   test "selection actions when anonymous user accesses shared project" do
     visit PUBLIC_PROJECT
 
@@ -171,10 +158,4 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
     assert_text 'script version'
     assert_no_selector 'a', text: 'Run this pipeline'
   end
-
-  test "visit public project as anonymous when anonymous browsing is not enabled and expect login page" do
-    Rails.configuration.anonymous_user_token = false
-    visit "/projects/#{api_fixture('groups')['aproject']['uuid']}"
-    assert_text 'Please log in'
-  end
 end
index 1cac667b22d3e61a2409fb5324f07b5d7ff2b516..1897a038589898d8b31514360ed952de64365f51 100644 (file)
@@ -125,10 +125,4 @@ class ErrorsTest < ActionDispatch::IntegrationTest
       Rails.configuration.arvados_v1_base = original_arvados_v1_base
     end
   end
-
-  test "404 page checks if user not logged in and makes suggestion" do
-    visit "/collections/#{BAD_UUID}"
-    assert_text 'you are not logged in'
-  end
-
 end