[ARVADOS] updated: 4bc67f80590ebbfe530d55b9109542f2b404e7b7

git at public.curoverse.com git at public.curoverse.com
Tue Feb 3 07:01:06 EST 2015


Summary of changes:
 apps/workbench/config/application.default.yml      |  1 +
 .../controllers/application_controller_test.rb     | 42 ++++++++--------------
 .../test/integration/anonymous_access_test.rb      | 36 ++++++++-----------
 3 files changed, 29 insertions(+), 50 deletions(-)

       via  4bc67f80590ebbfe530d55b9109542f2b404e7b7 (commit)
      from  b23240bded4d76bf953a4f8c499f58d9066c34dc (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 4bc67f80590ebbfe530d55b9109542f2b404e7b7
Author: Radhika Chippada <radhika at curoverse.com>
Date:   Tue Feb 3 07:00:30 2015 -0500

    2659: enable anonymous user config in test environment.

diff --git a/apps/workbench/config/application.default.yml b/apps/workbench/config/application.default.yml
index f43e8c6..ab81032 100644
--- a/apps/workbench/config/application.default.yml
+++ b/apps/workbench/config/application.default.yml
@@ -120,6 +120,7 @@ test:
         - Software developer
         - IT
         - Other
+  anonymous_user_token: 4kg6k6lzmp9kj4cpkcoxie964cmvjahbt4fod9zru44k4jqdmi
 
 common:
   assets.js_compressor: false
diff --git a/apps/workbench/test/controllers/application_controller_test.rb b/apps/workbench/test/controllers/application_controller_test.rb
index 30da596..fe57630 100644
--- a/apps/workbench/test/controllers/application_controller_test.rb
+++ b/apps/workbench/test/controllers/application_controller_test.rb
@@ -327,36 +327,22 @@ class ApplicationControllerTest < ActionController::TestCase
   end
 
   [
-    ['collections', false, api_fixture('collections')['user_agreement_in_anonymously_accessible_project']],
-    ['jobs', false, api_fixture('jobs')['running_job_in_publicly_accessible_project']],
-    ['pipeline_instances', false, api_fixture('pipeline_instances')['pipeline_in_publicly_accessible_project']],
-    ['pipeline_templates', false, api_fixture('pipeline_templates')['pipeline_template_in_publicly_accessible_project']],
-    ['projects', false, api_fixture('groups')['anonymously_accessible_project']],
-  ].each do |controller, use_config, fixture|
-    test "#{controller} show method with anonymous config enabled #{use_config}" do
-      if use_config
-        Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
-      else
-        Rails.configuration.anonymous_user_token = false
-      end
-
-      case controller
-      when 'collections'
-        @controller = CollectionsController.new
-      when 'jobs'
-        @controller = JobsController.new
-      when 'pipeline_instances'
-        @controller = PipelineInstancesController.new
-      when 'pipeline_templates'
-        @controller = PipelineTemplatesController.new
-      when 'projects'
-        @controller = ProjectsController.new
-      end
+    [CollectionsController.new, api_fixture('collections')['user_agreement_in_anonymously_accessible_project']],
+    [JobsController.new, api_fixture('jobs')['running_job_in_publicly_accessible_project']],
+    [PipelineInstancesController.new, api_fixture('pipeline_instances')['pipeline_in_publicly_accessible_project']],
+    [PipelineTemplatesController.new, api_fixture('pipeline_templates')['pipeline_template_in_publicly_accessible_project']],
+    [ProjectsController.new, api_fixture('groups')['anonymously_accessible_project']],
+  ].each do |controller, fixture|
+    test "#{controller} show method with anonymous config enabled" do
+      @controller = controller
 
       get(:show, {id: fixture['uuid']})
-
-      assert_response :redirect
-      assert_match /welcome/, @response.redirect_url
+      assert_response 200
+      if controller.class == JobsController
+        assert_includes @response.inspect, fixture['script']
+      else
+        assert_includes @response.inspect, fixture['name']
+      end
     end
   end
 end
diff --git a/apps/workbench/test/integration/anonymous_access_test.rb b/apps/workbench/test/integration/anonymous_access_test.rb
index f32fcbd..0476820 100644
--- a/apps/workbench/test/integration/anonymous_access_test.rb
+++ b/apps/workbench/test/integration/anonymous_access_test.rb
@@ -10,18 +10,7 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
     need_javascript
   end
 
-  def visit_publicly_accessible_project token=nil, path=nil
-    Rails.configuration.anonymous_user_token = api_fixture('api_client_authorizations')['anonymous']['api_token']
-
-    path = "/projects/#{api_fixture('groups')['anonymously_accessible_project']['uuid']}" if !path
-
-    if token
-      visit page_with_token(token, path)
-    else
-      visit path
-      assert_text 'Unrestricted public data' if path.include? 'anonymously_accessible_project'
-    end
-  end
+  PUBLIC_PROJECT = "/projects/#{api_fixture('groups')['anonymously_accessible_project']['uuid']}"
 
   def verify_site_navigation_anonymous_enabled user, is_active
     if user
@@ -52,19 +41,23 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
     ['active', api_fixture('users')['active'], true, true],
   ].each do |token, user, is_active|
     test "visit public project as user #{token.inspect} when anonymous browsing is enabled" do
-      visit_publicly_accessible_project token
+      if !token
+        visit PUBLIC_PROJECT
+      else
+        visit page_with_token(token, PUBLIC_PROJECT)
+      end
+
       verify_site_navigation_anonymous_enabled user, is_active
     end
   end
 
   test "visit non-public project as anonymous when anonymous browsing is enabled and expect page not found" do
-    visit_publicly_accessible_project nil,
-        "/projects/#{api_fixture('groups')['aproject']['uuid']}"
+    visit "/projects/#{api_fixture('groups')['aproject']['uuid']}"
     assert_text 'Not Found'
   end
 
   test "anonymous user clicking on topnav sees login page" do
-    visit_publicly_accessible_project
+    visit PUBLIC_PROJECT
 
     # click on topnav
     click_link 'workbench:test'
@@ -72,7 +65,7 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
   end
 
   test "selection actions when anonymous user accesses shared project" do
-    visit_publicly_accessible_project
+    visit PUBLIC_PROJECT
 
     assert_selector 'a', text: 'Data collections'
     assert_selector 'a', text: 'Jobs and pipelines'
@@ -93,7 +86,7 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
   end
 
   test "anonymous user accesses data collections tab in shared project" do
-    visit_publicly_accessible_project
+    visit PUBLIC_PROJECT
     assert_text 'GNU General Public License'
 
     assert_selector 'a', text: 'Data collections'
@@ -120,13 +113,13 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
     'pipelineInstance'
   ].each do |type|
     test "anonymous user accesses jobs and pipelines tab in shared project and clicks on #{type}" do
-      visit_publicly_accessible_project
+      visit PUBLIC_PROJECT
       assert_text 'GNU General Public License'
 
       click_link 'Jobs and pipelines'
       assert_text 'Pipeline in publicly accessible project'
 
-      # click on type specified collection
+      # click on the specified job
       if type.include? 'job'
         verify_job_row type
       else
@@ -143,7 +136,6 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
 
     assert_text 'zzzzz-tpzed-xurymjxw79nv3jz' # modified by user
     assert_no_selector 'a', text: 'zzzzz-tpzed-xurymjxw79nv3jz'
-    #assert_no_selector 'a', text: 'Log'  # this is finding 'Log in'
     assert_no_selector 'a', text: 'Move job'
     assert_no_selector 'button', text: 'Cancel'
     assert_no_selector 'button', text: 'Re-run job'
@@ -162,7 +154,7 @@ class AnonymousAccessTest < ActionDispatch::IntegrationTest
   end
 
   test "anonymous user accesses pipeline templates tab in shared project" do
-    visit_publicly_accessible_project
+    visit PUBLIC_PROJECT
     assert_text 'GNU General Public License'
 
     assert_selector 'a', text: 'Pipeline templates'

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list