[ARVADOS] created: 1c9e7c47db6d2823939f4aa8021ec47d15c1522f

git at public.curoverse.com git at public.curoverse.com
Tue Dec 16 12:46:45 EST 2014


        at  1c9e7c47db6d2823939f4aa8021ec47d15c1522f (commit)


commit 1c9e7c47db6d2823939f4aa8021ec47d15c1522f
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue Dec 16 11:16:59 2014 -0500

    4515: Add controller tests for search dialog.

diff --git a/apps/workbench/test/controllers/search_controller_test.rb b/apps/workbench/test/controllers/search_controller_test.rb
index bfbf22d..a09d966 100644
--- a/apps/workbench/test/controllers/search_controller_test.rb
+++ b/apps/workbench/test/controllers/search_controller_test.rb
@@ -1,7 +1,42 @@
 require 'test_helper'
 
 class SearchControllerTest < ActionController::TestCase
-  # test "the truth" do
-  #   assert true
-  # end
+  # These tests don't do state-changing API calls. Save some time by
+  # skipping the database reset.
+  reset_api_fixtures :after_each_test, false
+  reset_api_fixtures :after_suite, true
+
+  include Rails.application.routes.url_helpers
+
+  test 'Get search dialog' do
+    xhr :get, :choose, {
+      format: :js,
+      title: 'Search',
+      action_name: 'Show',
+      action_href: url_for(host: 'localhost', controller: :actions, action: :show),
+      action_data: {}.to_json,
+    }, session_for(:active)
+    assert_response :success
+  end
+
+  test 'Get search results for all projects' do
+    xhr :get, :choose, {
+      format: :json,
+      partial: true,
+    }, session_for(:active)
+    assert_response :success
+    assert_not_empty(json_response['content'],
+                     'search results for all projects should not be empty')
+  end
+
+  test 'Get search results for empty project' do
+    xhr :get, :choose, {
+      format: :json,
+      partial: true,
+      project_uuid: api_fixture('groups')['empty_project']['uuid'],
+    }, session_for(:active)
+    assert_response :success
+    assert_empty(json_response['content'],
+                 'search results for empty project should be empty')
+  end
 end
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index c98cdfa..86815c0 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -139,6 +139,18 @@ group_for_sharing_tests:
   description: Users who can share objects with each other
   group_class: role
 
+empty_project:
+  uuid: zzzzz-j7d0g-9otoxmrksam74q6
+  owner_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  created_at: 2014-12-16 15:56:27.967534940 Z
+  modified_by_client_uuid: ~
+  modified_by_user_uuid: zzzzz-tpzed-xurymjxw79nv3jz
+  modified_at: 2014-12-16 15:56:27.967358199 Z
+  name: Empty project
+  description: ~
+  updated_at: 2014-12-16 15:56:27.967242142 Z
+  group_class: project
+
 project_with_10_collections:
   uuid: zzzzz-j7d0g-0010collections
   owner_uuid: zzzzz-tpzed-user1withloadab

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list