[ARVADOS] updated: d61f56590d4c1bc2c965b640698217a5d4af1d8c
git at public.curoverse.com
git at public.curoverse.com
Fri Apr 25 10:08:39 EDT 2014
Summary of changes:
apps/workbench/app/models/arvados_api_client.rb | 2 +-
apps/workbench/app/models/group.rb | 4 +
apps/workbench/app/models/user.rb | 5 +
.../app/views/layouts/application.html.erb | 1 -
apps/workbench/test/test_helper.rb | 16 ++-
apps/workbench/test/unit/user_test.rb | 15 ++-
doc/api/methods/groups.html.textile.liquid | 12 ++
doc/api/methods/users.html.textile.liquid | 12 ++
doc/api/schema/Group.html.textile.liquid | 6 +-
doc/api/schema/Link.html.textile.liquid | 8 +-
.../api/app/controllers/application_controller.rb | 191 ++++++++++++++------
services/api/app/models/group.rb | 1 +
services/api/config/routes.rb | 5 +-
.../20140421140924_add_group_class_to_groups.rb | 6 +
.../migrate/20140421151940_timestamps_not_null.rb | 13 ++
services/api/db/schema.rb | 32 ++--
services/api/lib/assign_uuid.rb | 11 +-
services/api/test/fixtures/groups.yml | 24 +++
services/api/test/fixtures/links.yml | 14 ++
services/api/test/fixtures/specimens.yml | 12 ++
.../arvados/v1/groups_controller_test.rb | 112 ++++++++++++
.../functional/arvados/v1/users_controller_test.rb | 76 ++++++++
.../api_client_authorizations_api_test.rb | 6 +-
.../api/test/integration/collections_api_test.rb | 24 ++--
services/api/test/integration/errors_test.rb | 2 +-
services/api/test/integration/jobs_api_test.rb | 4 +-
services/api/test/integration/permissions_test.rb | 12 +-
services/api/test/integration/valid_links_test.rb | 2 +-
services/api/test/test_helper.rb | 8 +-
29 files changed, 517 insertions(+), 119 deletions(-)
create mode 100644 services/api/db/migrate/20140421140924_add_group_class_to_groups.rb
create mode 100644 services/api/db/migrate/20140421151940_timestamps_not_null.rb
via d61f56590d4c1bc2c965b640698217a5d4af1d8c (commit)
via 62ce10f18cb083d701471d0fe27e964c85214200 (commit)
via 73e28547278ddff84847c12ad7f926e717ae553a (commit)
via 6f918d1fc451f1ad72350677155a0d67f40a9628 (commit)
via c0aeec88f6507f441796d25ad2dfb49c78185731 (commit)
via d6399c117f03f45e83648dca6e23dd7174793253 (commit)
via 8905037aede017ccdb66dd2850bfbd2284904e4e (commit)
via 7fc48a11da8740deb01b0063faa2ceb687709205 (commit)
via 694e4fdd124150f1b0a237ce6a698f3d00d92eb9 (commit)
via 7efcc87e3cba4f03429751f9f3d109cc88e6926c (commit)
via 75fa6afdd3f0f85d48e7a95372dd8cf094811221 (commit)
via d2d9ff48a6c111293340ac351f94428e5204366f (commit)
via d325f035a861d1421f6e2fe0d2f01e9f3e93d749 (commit)
via 61f4536217e0beeafab54a8b66d40f859fdd1306 (commit)
via 04e99ad773e4a47dabc7f0e1b624f67a00ff00b9 (commit)
via 6f6c9a2c6e7b871ad9ee592f45ebfdb7f5f26ee1 (commit)
via deed6e331c70c4410b161f260e2b93fa71b39d50 (commit)
via 44480d99e71e1868f61024035d7d58acd69eac50 (commit)
via 448cff33fc343a54caa1a33f4a536d88e3e4eaa1 (commit)
via 5588c452453499d0aa130abe6421df5e85cf5703 (commit)
from f93ebd504f60b3055c254e23ba987ed29e8987b2 (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 d61f56590d4c1bc2c965b640698217a5d4af1d8c
Merge: 62ce10f 73e2854
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Apr 25 10:07:36 2014 -0400
Merge branch '2640-folder-api'
refs #2640
Conflicts:
services/api/app/controllers/application_controller.rb
services/api/config/routes.rb
diff --cc apps/workbench/test/unit/user_test.rb
index 82f61e0,2a47217..d827651
--- a/apps/workbench/test/unit/user_test.rb
+++ b/apps/workbench/test/unit/user_test.rb
@@@ -1,7 -1,16 +1,16 @@@
require 'test_helper'
class UserTest < ActiveSupport::TestCase
- # test "the truth" do
- # assert true
- # end
+ test "get owned_items" do
+ use_token :active
+ oi = User.find(api_fixture('users')['active']['uuid']).owned_items
+ assert_operator(0, :<, oi.count,
+ "Expected to find some items belonging to :active user")
- assert_operator(0, :<, oi.items_available
++ assert_operator(0, :<, oi.items_available,
+ "Expected owned_items response to have items_available > 0")
+ oi_uuids = oi.collect { |i| i['uuid'] }
+ expect = api_fixture('specimens')['owned_by_active_user']['uuid']
+ assert_includes(oi_uuids, expect,
+ "Expected active user's owned_items to include #{expect}")
+ end
end
diff --cc services/api/app/controllers/application_controller.rb
index fcc7618,74f6bb2..6339125
--- a/services/api/app/controllers/application_controller.rb
+++ b/services/api/app/controllers/application_controller.rb
@@@ -164,15 -268,19 +273,19 @@@ class ApplicationController < ActionCon
operand = Time.parse operand
end
param_out << operand
+ elsif operand.nil? and operator == '='
+ cond_out << "#{ar_table_name}.#{attr} is null"
else
- raise ArgumentError.new("Invalid operand type '#{operand.class}' for '#{operator}' operator in filter")
- raise ArgumentError.new("Invalid operand type '#{attr.class}' "\
++ raise ArgumentError.new("Invalid operand type '#{operand.class}' "\
+ "for '#{operator}' operator in filters")
end
when 'in'
if operand.is_a? Array
- cond_out << "#{table_name}.#{attr} IN (?)"
+ cond_out << "#{ar_table_name}.#{attr} IN (?)"
param_out << operand
else
- raise ArgumentError.new("Invalid argument '#{operand}' for 'in' operator in filter")
- raise ArgumentError.new("Invalid operand type '#{attr.class}' "\
++ raise ArgumentError.new("Invalid operand type '#{operand.class}' "\
+ "for '#{operator}' operator in filters")
end
when 'is_a'
operand = [operand] unless operand.is_a? Array
diff --cc services/api/config/routes.rb
index 5a11143,cfd3b61..b229511
--- a/services/api/config/routes.rb
+++ b/services/api/config/routes.rb
@@@ -5,54 -81,50 +5,57 @@@ Server::Application.routes.draw d
namespace :arvados do
namespace :v1 do
- match '/nodes/:uuid/ping' => 'nodes#ping', :as => :ping_node
- match '/keep_disks/ping' => 'keep_disks#ping', :as => :ping_keep_disk
- match '/links/from/:tail_uuid' => 'links#index', :as => :arvados_v1_links_from
- match '/users/current' => 'users#current'
- match '/users/system' => 'users#system'
- match '/jobs/queue' => 'jobs#queue'
- match '/jobs/:uuid/log_tail_follow' => 'jobs#log_tail_follow'
- post '/jobs/:uuid/cancel' => 'jobs#cancel'
- match '/users/:uuid/event_stream' => 'users#event_stream'
- post '/users/:uuid/activate' => 'users#activate'
- post '/users/setup' => 'users#setup'
- post '/users/:uuid/unsetup' => 'users#unsetup'
- match '/virtual_machines/get_all_logins' => 'virtual_machines#get_all_logins'
- match '/virtual_machines/:uuid/logins' => 'virtual_machines#logins'
- post '/api_client_authorizations/create_system_auth' => 'api_client_authorizations#create_system_auth'
- match '/repositories/get_all_permissions' => 'repositories#get_all_permissions'
- get '/user_agreements/signatures' => 'user_agreements#signatures'
- post '/user_agreements/sign' => 'user_agreements#sign'
- get '/collections/:uuid/provenance' => 'collections#provenance'
- get '/collections/:uuid/used_by' => 'collections#used_by'
- resources :collections
- resources :links
- resources :nodes
- resources :pipeline_templates
- resources :pipeline_instances
- resources :specimens
+ resources :api_client_authorizations do
+ post 'create_system_auth', on: :collection
+ end
+ resources :api_clients
+ resources :authorized_keys
+ resources :collections do
+ get 'provenance', on: :member
+ get 'used_by', on: :member
+ end
- resources :groups
+ resources :groups do
+ get 'owned_items', on: :member
+ end
+ resources :humans
+ resources :job_tasks
+ resources :jobs do
+ get 'queue', on: :collection
+ get 'log_tail_follow', on: :member
+ post 'cancel', on: :member
+ end
+ resources :keep_disks do
+ post 'ping', on: :collection
+ end
+ resources :links
resources :logs
+ resources :nodes do
+ post 'ping', on: :member
+ end
+ resources :pipeline_instances
+ resources :pipeline_templates
+ resources :repositories do
+ get 'get_all_permissions', on: :collection
+ end
+ resources :specimens
+ resources :traits
+ resources :user_agreements do
+ get 'signatures', on: :collection
+ post 'sign', on: :collection
+ end
resources :users do
+ get 'current', on: :collection
+ get 'system', on: :collection
+ get 'event_stream', on: :member
+ post 'activate', on: :member
+ post 'setup', on: :collection
+ post 'unsetup', on: :member
+ get 'owned_items', on: :member
end
- resources :api_clients
- resources :api_client_authorizations
- resources :jobs
- resources :job_tasks
- resources :keep_disks
- resources :authorized_keys
- resources :virtual_machines
- resources :repositories
- resources :traits
- resources :humans
- resources :user_agreements
+ resources :virtual_machines do
+ get 'logins', on: :member
+ get 'get_all_logins', on: :collection
+ end
end
end
diff --cc services/api/test/integration/collections_api_test.rb
index e13d336,8856fd5..b0fddb8
--- a/services/api/test/integration/collections_api_test.rb
+++ b/services/api/test/integration/collections_api_test.rb
@@@ -12,45 -12,9 +12,45 @@@ class CollectionsApiTest < ActionDispat
test "get index with filters= (empty string)" do
get "/arvados/v1/collections", {:format => :json, :filters => ''}, auth(:active)
assert_response :success
- assert_equal "arvados#collectionList", jresponse['kind']
+ assert_equal "arvados#collectionList", json_response['kind']
end
+ test "get index with invalid filters (array of strings) responds 422" do
+ get "/arvados/v1/collections", {
+ :format => :json,
+ :filters => ['uuid', '=', 'ad02e37b6a7f45bbe2ead3c29a109b8a+54'].to_json
+ }, auth(:active)
+ assert_response 422
- assert_match /nvalid element.*not an array/, jresponse['errors'].join(' ')
++ assert_match /nvalid element.*not an array/, json_response['errors'].join(' ')
+ end
+
+ test "get index with invalid filters (unsearchable column) responds 422" do
+ get "/arvados/v1/collections", {
+ :format => :json,
+ :filters => [['this_column_does_not_exist', '=', 'bogus']].to_json
+ }, auth(:active)
+ assert_response 422
- assert_match /nvalid attribute/, jresponse['errors'].join(' ')
++ assert_match /nvalid attribute/, json_response['errors'].join(' ')
+ end
+
+ test "get index with invalid filters (invalid operator) responds 422" do
+ get "/arvados/v1/collections", {
+ :format => :json,
+ :filters => [['uuid', ':-(', 'displeased']].to_json
+ }, auth(:active)
+ assert_response 422
- assert_match /nvalid operator/, jresponse['errors'].join(' ')
++ assert_match /nvalid operator/, json_response['errors'].join(' ')
+ end
+
+ test "get index with invalid filters (invalid operand type) responds 422" do
+ get "/arvados/v1/collections", {
+ :format => :json,
+ :filters => [['uuid', '=', {foo: 'bar'}]].to_json
+ }, auth(:active)
+ assert_response 422
- assert_match /nvalid operand type/, jresponse['errors'].join(' ')
++ assert_match /nvalid operand type/, json_response['errors'].join(' ')
+ end
+
test "get index with where= (empty string)" do
get "/arvados/v1/collections", {:format => :json, :where => ''}, auth(:active)
assert_response :success
diff --cc services/api/test/integration/errors_test.rb
index 3a58e48,0000000..b2ef13e
mode 100644,000000..100644
--- a/services/api/test/integration/errors_test.rb
+++ b/services/api/test/integration/errors_test.rb
@@@ -1,27 -1,0 +1,27 @@@
+require 'test_helper'
+
+class ErrorsTest < ActionDispatch::IntegrationTest
+ fixtures :api_client_authorizations
+
+ %w(/arvados/v1/shoes /arvados/shoes /shoes /nodes /users).each do |path|
+ test "non-existent route #{path}" do
+ get path, {:format => :json}, auth(:active)
+ assert_nil assigns(:objects)
+ assert_nil assigns(:object)
- assert_not_nil jresponse['errors']
++ assert_not_nil json_response['errors']
+ assert_response 404
+ end
+ end
+
+ n=0
+ Rails.application.routes.routes.each do |route|
+ test "route #{n += 1} '#{route.path.spec.to_s}' is not an accident" do
+ # Generally, new routes should appear under /arvados/v1/. If
+ # they appear elsewhere, that might have been caused by default
+ # rails generator behavior that we don't want.
+ assert_match(/^\/(|\*a|arvados\/v1\/.*|auth\/.*|login|logout|discovery\/.*|static\/.*|themes\/.*)(\(\.:format\))?$/,
+ route.path.spec.to_s,
+ "Unexpected new route: #{route.path.spec}")
+ end
+ end
+end
commit 62ce10f18cb083d701471d0fe27e964c85214200
Author: Tom Clegg <tom at curoverse.com>
Date: Fri Apr 25 09:53:12 2014 -0400
Remove "Admin Guide" link from left nav.
diff --git a/apps/workbench/app/views/layouts/application.html.erb b/apps/workbench/app/views/layouts/application.html.erb
index e23265a..9da171e 100644
--- a/apps/workbench/app/views/layouts/application.html.erb
+++ b/apps/workbench/app/views/layouts/application.html.erb
@@ -220,7 +220,6 @@
<li><%= link_to 'Tutorials and User guide', "#{Rails.configuration.arvados_docsite}/user", target: "_blank" %></li>
<li><%= link_to 'API Reference', "#{Rails.configuration.arvados_docsite}/api", target: "_blank" %></li>
<li><%= link_to 'SDK Reference', "#{Rails.configuration.arvados_docsite}/sdk", target: "_blank" %></li>
- <li><%= link_to 'Admin guide', "#{Rails.configuration.arvados_docsite}/admin", target: "_blank" %></li>
</ul>
</li>
</ul>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list