8876: improve jobs_with_components test to have components that can be un/read
authorradhika <radhika@curoverse.com>
Tue, 31 May 2016 16:52:35 +0000 (12:52 -0400)
committerradhika <radhika@curoverse.com>
Tue, 31 May 2016 16:52:35 +0000 (12:52 -0400)
apps/workbench/test/integration/jobs_test.rb
services/api/test/fixtures/api_client_authorizations.yml
services/api/test/fixtures/links.yml
services/api/test/fixtures/users.yml

index 1ad3296071e95dff37a78730367e2f99cabbd79e..be6a83dcac16acd2edcf62221d7611654b8efcd6 100644 (file)
@@ -129,7 +129,7 @@ class JobsTest < ActionDispatch::IntegrationTest
 
   [
     ['active', true],
-    ['job_reader', false],
+    ['job_reader2', false],
   ].each do |user, readable|
     test "view job with components as #{user} user" do
       job = api_fixture('jobs')['running_job_with_components']
@@ -142,26 +142,28 @@ class JobsTest < ActionDispatch::IntegrationTest
       assert page.has_text? job['script_version']
       assert page.has_no_text? 'script_parameters'
 
+      # The job_reader2 is allowed to read job, component2, and component2_child1,
+      # and component2_child2 only as a component of the pipeline component2
       if readable
         assert page.has_link? 'component1'
         assert page.has_link? 'component2'
       else
-        # children are not readable by user
         assert page.has_no_link? 'component1'
-        assert page.has_no_link? 'component2'
-        return
+        assert page.has_link? 'component2'
       end
 
-      click_link('component1')
-      within('#collapse1') do
-        assert(has_text? component1['uuid'])
-        assert(has_text? component1['script_version'])
-        assert(has_text? 'script_parameters')
+      if readable
+        click_link('component1')
+        within('#collapse1') do
+          assert(has_text? component1['uuid'])
+          assert(has_text? component1['script_version'])
+          assert(has_text? 'script_parameters')
+        end
+        click_link('component1')
       end
-      click_link('component1')
 
       click_link('component2')
-      within('#collapse2') do
+      within('.panel-collapse') do
         assert(has_text? component2['uuid'])
         assert(has_text? component2['script_version'])
         assert(has_no_text? 'script_parameters')
@@ -169,16 +171,20 @@ class JobsTest < ActionDispatch::IntegrationTest
         assert(has_link? 'running')
 
         click_link('previous')
-        within('#collapse3') do
+        within('.panel-collapse') do
           assert(has_text? component2_child1['uuid'])
           assert(has_text? component2_child1['script_version'])
         end
         click_link('previous')
 
         click_link('running')
-        within('#collapse4') do
+        within('.panel-collapse') do
           assert(has_text? component2_child2['uuid'])
-          assert(has_text? component2_child2['script_version'])
+          if readable
+            assert(has_text? component2_child2['script_version'])
+          else
+            assert(has_no_text? component2_child2['script_version'])
+          end
         end
       end
     end
index d6c0e40e7cc00a66dd0b93b3b86b36ef9ad770a0..1f9fe0793a7a65068043717e89b2102ef9cda39c 100644 (file)
@@ -222,6 +222,14 @@ job_reader:
   api_token: e99512cdc0f3415c2428b9758f33bdfb07bc3561b00e86e7e6
   expires_at: 2038-01-01 00:00:00
 
+job_reader2:
+  uuid: zzzzz-gj3su-jobreader2autht
+  api_client: untrusted
+  user: job_reader2
+  api_token: e99512cdc0f3415c2428b9758f33bdfb07bc3561b00e86e7e6
+  api_token: jobreader2415c2428b9758f33bdfb07bc3561b0jobreader2
+  expires_at: 2038-01-01 00:00:00
+
 active_no_prefs:
   uuid: zzzzz-gj3su-307z32aux8dg2s1
   api_client: untrusted
@@ -276,4 +284,4 @@ dispatch1:
   api_client: untrusted
   user: system_user
   api_token: kwi8oowusvbutahacwk2geulqewy5oaqmpalczfna4b6bb0hfw
-  expires_at: 2038-01-01 00:00:00
\ No newline at end of file
+  expires_at: 2038-01-01 00:00:00
index 96e82ccbc93ab4dd930cbacf9813ed36a42b03ca..2d1e55215b1cfbf4f3442b85e5bf4de717ed0d75 100644 (file)
@@ -702,8 +702,8 @@ job_reader_can_read_previous_job_run:
   tail_uuid: zzzzz-tpzed-905b42d1dd4a354
   head_uuid: zzzzz-8i9sb-cjs4pklxxjykqqq
 
-job_reader_can_read_job_with_components:
-  # Permission link giving job_reader permission
+job_reader2_can_read_job_with_components:
+  # Permission link giving job_reader2 permission
   # to read running_job_with_components
   uuid: zzzzz-o0j2j-jobcomps4jobrdr
   owner_uuid: zzzzz-tpzed-000000000000000
@@ -714,11 +714,41 @@ job_reader_can_read_job_with_components:
   updated_at: 2014-06-13 20:42:26 -0800
   link_class: permission
   name: can_read
-  tail_uuid: zzzzz-tpzed-905b42d1dd4a354
+  tail_uuid: zzzzz-tpzed-readjobwithcomp
   head_uuid: zzzzz-8i9sb-with2components
 
-job_reader_can_read_foo_repo:
-  # Permission link giving job_reader permission
+job_reader2_can_read_pipeline_from_job_with_components:
+  # Permission link giving job_reader2 permission
+  # to read running_job_with_components
+  uuid: zzzzz-o0j2j-pi4comps4jobrdr
+  owner_uuid: zzzzz-tpzed-000000000000000
+  created_at: 2014-06-13 20:42:26 -0800
+  modified_by_client_uuid: zzzzz-tpzed-000000000000000
+  modified_by_user_uuid: zzzzz-tpzed-000000000000000
+  modified_at: 2014-06-13 20:42:26 -0800
+  updated_at: 2014-06-13 20:42:26 -0800
+  link_class: permission
+  name: can_read
+  tail_uuid: zzzzz-tpzed-readjobwithcomp
+  head_uuid: zzzzz-d1hrv-partdonepipelin
+
+job_reader2_can_read_first_job_from_pipeline_from_job_with_components:
+  # Permission link giving job_reader2 permission
+  # to read running_job_with_components
+  uuid: zzzzz-o0j2j-job4pi4j4jobrdr
+  owner_uuid: zzzzz-tpzed-000000000000000
+  created_at: 2014-06-13 20:42:26 -0800
+  modified_by_client_uuid: zzzzz-tpzed-000000000000000
+  modified_by_user_uuid: zzzzz-tpzed-000000000000000
+  modified_at: 2014-06-13 20:42:26 -0800
+  updated_at: 2014-06-13 20:42:26 -0800
+  link_class: permission
+  name: can_read
+  tail_uuid: zzzzz-tpzed-readjobwithcomp
+  head_uuid: zzzzz-8i9sb-cjs4pklxxjykqqq
+
+job_reader2_can_read_foo_repo:
+  # Permission link giving job_reader2 permission
   # to read foo_repo
   uuid: zzzzz-o0j2j-072ec05dc9487f8
   owner_uuid: zzzzz-tpzed-000000000000000
@@ -729,7 +759,7 @@ job_reader_can_read_foo_repo:
   updated_at: 2014-06-13 20:42:26 -0800
   link_class: permission
   name: can_read
-  tail_uuid: zzzzz-tpzed-905b42d1dd4a354
+  tail_uuid: zzzzz-tpzed-readjobwithcomp
   head_uuid: zzzzz-s0uqq-382brsig8rp3666
 
 baz_collection_name_in_asubproject:
index b15ada12b426d648b564faf4a36604e9eb6b6128..7104af26f7e43b610260218d7e0ca5243058744d 100644 (file)
@@ -209,6 +209,22 @@ job_reader:
       role: Computational biologist
     getting_started_shown: 2015-03-26 12:34:56.789000000 Z
 
+job_reader2:
+  owner_uuid: zzzzz-tpzed-000000000000000
+  uuid: zzzzz-tpzed-readjobwithcomp
+  email: job_reader2@arvados.local
+  first_name: Job
+  last_name: Reader2
+  identity_url: https://job_reader2.openid.local
+  is_active: true
+  is_admin: false
+  username: jobreader2
+  prefs:
+    profile:
+      organization: example.com
+      role: Computational biologist
+    getting_started_shown: 2015-03-26 12:34:56.789000000 Z
+
 active_no_prefs:
   owner_uuid: zzzzz-tpzed-000000000000000
   uuid: zzzzz-tpzed-a46c42d1td4aoj4