[ARVADOS] updated: ebdbddd3c85ab869afcf689efd7cb4b6207000b3

git at public.curoverse.com git at public.curoverse.com
Fri Sep 26 13:25:41 EDT 2014


Summary of changes:
 .../pipeline_instances_controller_test.rb          |  7 ++++
 .../arvados/v1/collections_controller_test.rb      | 35 +++++++++++++++---
 .../functional/arvados/v1/jobs_controller_test.rb  |  8 +++--
 .../functional/arvados/v1/logs_controller_test.rb  | 13 +++----
 services/api/test/integration/groups_test.rb       | 42 ++++++++++++++++++++++
 5 files changed, 91 insertions(+), 14 deletions(-)
 create mode 100644 services/api/test/integration/groups_test.rb

       via  ebdbddd3c85ab869afcf689efd7cb4b6207000b3 (commit)
       via  93817175e247780a3aa74494e3d2f08eb1a9cd37 (commit)
      from  9bf347ea56bc74da1c0ff1a3809faf1ae58f5890 (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 ebdbddd3c85ab869afcf689efd7cb4b6207000b3
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 26 13:24:56 2014 -0400

    3889: some monir assertion updates.

diff --git a/services/api/test/functional/arvados/v1/jobs_controller_test.rb b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
index 7541bc7..e4f70cf 100644
--- a/services/api/test/functional/arvados/v1/jobs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/jobs_controller_test.rb
@@ -120,16 +120,18 @@ class Arvados::V1::JobsControllerTest < ActionController::TestCase
     assert_not_nil job['cancelled_at'], 'un-cancelled job stays cancelled'
   end
 
-  ['admin', 'active'].each do |user|
-    test "#{user} update a job without failing script_version check" do
+  ['abc.py', 'hash.py'].each do |script|
+    test "update job script attribute to #{script} without failing script_version check" do
       authorize_with :admin
       put :update, {
         id: jobs(:uses_nonexistent_script_version).uuid,
         job: {
-          owner_uuid: users(user).uuid
+          script: script
         }
       }
       assert_response :success
+      resp = assigns(:object)
+      assert_equal jobs(:uses_nonexistent_script_version).script_version, resp['script_version']
     end
   end
 
diff --git a/services/api/test/functional/arvados/v1/logs_controller_test.rb b/services/api/test/functional/arvados/v1/logs_controller_test.rb
index 96daa5b..f3826ca 100644
--- a/services/api/test/functional/arvados/v1/logs_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/logs_controller_test.rb
@@ -5,19 +5,20 @@ class Arvados::V1::LogsControllerTest < ActionController::TestCase
 
   test "non-admins can create their own logs" do
     authorize_with :active
-    post :create, log: {summary: "test log"}
+    post :create, log: {summary: 'test log'}
     assert_response :success
-    uuid = JSON.parse(@response.body)['uuid']
-    assert_not_nil uuid
+    resp = assigns(:object)
+    assert_not_nil resp.uuid
+    assert_equal('test log', resp.summary, "loaded wrong log after creation")
   end
 
   test "non-admins can read their own logs" do
     authorize_with :active
     my_log = logs(:log_owned_by_active)
     get :show, {id: my_log[:uuid]}
-    assert_response(:success, "failed to load created log")
-    assert_equal(my_log[:summary], assigns(:object).summary,
-                 "loaded wrong log after creation")
+    assert_response(:success, "failed to get log")
+    resp = assigns(:object)
+    assert_equal(my_log[:summary], resp.summary, "got wrong log")
   end
 
   test "test can still use where object_kind" do
diff --git a/services/api/test/integration/groups_test.rb b/services/api/test/integration/groups_test.rb
new file mode 100644
index 0000000..c144a0f
--- /dev/null
+++ b/services/api/test/integration/groups_test.rb
@@ -0,0 +1,42 @@
+require 'test_helper'
+
+class GroupTest < ActionDispatch::IntegrationTest
+
+  test "get all pages of group-owned objects" do
+    limit = 5
+    offset = 0
+    items_available = nil
+    uuid_received = {}
+    owner_received = {}
+    while true
+      @json_response = nil
+
+      get "/arvados/v1/groups/contents", {
+        id: groups(:aproject).uuid,
+        limit: limit,
+        offset: offset,
+        format: :json,
+      }, auth(:active)
+
+      assert_response :success
+      assert_operator(0, :<, json_response['items'].count,
+                      "items_available=#{items_available} but received 0 "\
+                      "items with offset=#{offset}")
+      items_available ||= json_response['items_available']
+      assert_equal(items_available, json_response['items_available'],
+                   "items_available changed between page #{offset/limit} "\
+                   "and page #{1+offset/limit}")
+      json_response['items'].each do |item|
+        uuid = item['uuid']
+        assert_equal(nil, uuid_received[uuid],
+                     "Received '#{uuid}' again on page #{1+offset/limit}")
+        uuid_received[uuid] = true
+        owner_received[item['owner_uuid']] = true
+        offset += 1
+        assert_equal groups(:aproject).uuid, item['owner_uuid']
+      end
+      break if offset >= items_available
+    end
+  end
+
+end

commit 93817175e247780a3aa74494e3d2f08eb1a9cd37
Author: radhika <radhika at curoverse.com>
Date:   Fri Sep 26 10:22:24 2014 -0400

    3889: add "#{user} can get collection using portable data hash" test

diff --git a/apps/workbench/test/functional/pipeline_instances_controller_test.rb b/apps/workbench/test/functional/pipeline_instances_controller_test.rb
index 7f60689..6fe4424 100644
--- a/apps/workbench/test/functional/pipeline_instances_controller_test.rb
+++ b/apps/workbench/test/functional/pipeline_instances_controller_test.rb
@@ -2,6 +2,7 @@ require 'test_helper'
 
 class PipelineInstancesControllerTest < ActionController::TestCase
   def create_instance_long_enough_to(instance_attrs={})
+    # create 'two_part' pipeline with the given instance attributes
     pt_fixture = api_fixture('pipeline_templates')['two_part']
     post :create, {
       pipeline_instance: instance_attrs.merge({
@@ -12,7 +13,13 @@ class PipelineInstancesControllerTest < ActionController::TestCase
     assert_response :success
     pi_uuid = assigns(:object).uuid
     assert_not_nil assigns(:object)
+
+    # yield
     yield pi_uuid, pt_fixture
+
+    # delete the pipeline instance
+    use_token :active
+    PipelineInstance.where(uuid: pi_uuid).first.destroy
   end
 
   test "pipeline instance components populated after create" do
diff --git a/services/api/test/functional/arvados/v1/collections_controller_test.rb b/services/api/test/functional/arvados/v1/collections_controller_test.rb
index eb91e7d..7ffb906 100644
--- a/services/api/test/functional/arvados/v1/collections_controller_test.rb
+++ b/services/api/test/functional/arvados/v1/collections_controller_test.rb
@@ -104,17 +104,42 @@ EOS
     assert_response :success
     assert_nil assigns(:objects)
 
-    created = JSON.parse(@response.body)
+    response_collection = assigns(:object)
 
-    retrieved_collection = Collection.select([:uuid, :portable_data_hash, :manifest_text]).
-      where(portable_data_hash: created['portable_data_hash']).first
+    stored_collection = Collection.select([:uuid, :portable_data_hash, :manifest_text]).
+      where(portable_data_hash: response_collection['portable_data_hash']).first
 
-    assert_equal test_collection[:portable_data_hash], retrieved_collection['portable_data_hash']
+    assert_equal test_collection[:portable_data_hash], stored_collection['portable_data_hash']
 
     # The manifest in the response will have had permission hints added.
     # Remove any permission hints in the response before comparing it to the source.
-    stripped_manifest = retrieved_collection['manifest_text'].gsub(/\+A[A-Za-z0-9 at _-]+/, '')
+    stripped_manifest = stored_collection['manifest_text'].gsub(/\+A[A-Za-z0-9 at _-]+/, '')
     assert_equal test_collection[:manifest_text], stripped_manifest
+
+    # TBD: create action should add permission signatures to manifest_text in the response,
+    # and we need to check those permission signatures here.
+  end
+
+  [:admin, :active].each do |user|
+    test "#{user} can get collection using portable data hash" do
+      authorize_with user
+
+      foo_collection = collections(:foo_file)
+
+      # Get foo_file using it's portable data has
+      get :show, {
+        id: foo_collection[:portable_data_hash]
+      }
+      assert_response :success
+      assert_not_nil assigns(:object)
+      resp = assigns(:object)
+      assert_equal foo_collection[:portable_data_hash], resp['portable_data_hash']
+
+      # The manifest in the response will have had permission hints added.
+      # Remove any permission hints in the response before comparing it to the source.
+      stripped_manifest = resp['manifest_text'].gsub(/\+A[A-Za-z0-9 at _-]+/, '')
+      assert_equal foo_collection[:manifest_text], stripped_manifest
+    end
   end
 
   test "create with owner_uuid set to owned group" do

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list