[ARVADOS] updated: 94a996322c6cee6c35a0df50b261f0f003490e50

git at public.curoverse.com git at public.curoverse.com
Mon Aug 17 10:23:38 EDT 2015


Summary of changes:
 .../app/controllers/application_controller.rb        |  2 +-
 .../test/controllers/projects_controller_test.rb     | 17 +++++++++++++++++
 apps/workbench/test/integration/projects_test.rb     | 20 --------------------
 services/api/test/fixtures/groups.yml                | 16 ----------------
 4 files changed, 18 insertions(+), 37 deletions(-)

       via  94a996322c6cee6c35a0df50b261f0f003490e50 (commit)
      from  850807f8b0df927796e5f189c807092ca3112dca (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 94a996322c6cee6c35a0df50b261f0f003490e50
Author: Manoj <jonam33 at gmail.com>
Date:   Mon Aug 17 10:22:47 2015 -0400

    6640: Removed integration test and added controller test, fixed bug
    causing different projects to be seen.

diff --git a/apps/workbench/app/controllers/application_controller.rb b/apps/workbench/app/controllers/application_controller.rb
index e4e2f71..31a259b 100644
--- a/apps/workbench/app/controllers/application_controller.rb
+++ b/apps/workbench/app/controllers/application_controller.rb
@@ -745,7 +745,7 @@ class ApplicationController < ActionController::Base
   helper_method :all_projects
   def all_projects
     @all_projects = Group.
-      filter([['group_class','=','project']]).order('name').limit(10000)
+      filter([['group_class','=','project']]).order('name').limit(nil)
   end
 
   helper_method :my_projects
diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index afcba93..e497069 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -407,4 +407,21 @@ class ProjectsControllerTest < ActionController::TestCase
     refute_empty css_select("[href=\"/projects/#{project['uuid']}\"]")
     assert_includes @response.body, "<a href=\"/projects/public\">Public Projects</a>"
   end
+
+  test "project menu shows all projects owned" do
+    use_token :user1_with_load
+
+    # API server returns 100 objects per request even if more exist.
+    # So create 101 objects to verify that multiple pages are fetched as needed
+    (1..101).each do |i|
+      Group.create(name: "My new project #{i}", group_class: 'project')
+    end
+
+    # Get all_projects readable by this user
+    all_projects = @controller.send :all_projects
+    refute_nil all_projects
+
+    assert_equal true, all_projects.items_available>101
+    assert_equal all_projects.items_available, all_projects.results.length
+  end
 end
diff --git a/apps/workbench/test/integration/projects_test.rb b/apps/workbench/test/integration/projects_test.rb
index d542a42..73b441b 100644
--- a/apps/workbench/test/integration/projects_test.rb
+++ b/apps/workbench/test/integration/projects_test.rb
@@ -471,26 +471,6 @@ class ProjectsTest < ActionDispatch::IntegrationTest
     end
   end
 
-  test "project menu shows all projects owned" do
-    visit page_with_token("user1_with_load")
-    find("#projects-menu").click
-    page_scrolls = 301/20 + 2  # scroll num_pages+2 times to test scrolling is disabled when it should be
-    within('.dropdown-menu') do
-      (0..page_scrolls).each do |i|
-        page.driver.scroll_to 0, 999000
-        begin
-          wait_for_ajax
-        rescue
-        end
-      end
-    end
-    # Verify that expected number of projects are found
-    found_items = page.all('li')
-    found_count = found_items.count
-    assert_equal(true, found_count>=301,
-      "Found too few items. Expected at least 301 and found #{found_count}")
-  end
-
   [
     ['project_with_10_collections', 10],
     ['project_with_201_collections', 201], # two pages of data
diff --git a/services/api/test/fixtures/groups.yml b/services/api/test/fixtures/groups.yml
index 2da2173..f6b99a0 100644
--- a/services/api/test/fixtures/groups.yml
+++ b/services/api/test/fixtures/groups.yml
@@ -282,19 +282,3 @@ subproject_in_asubproject_with_same_name_as_one_in_active_user_home:
   name: Subproject to test owner uuid and name unique key violation upon removal
   description: "Removing this will result in name conflict with 'A project' in Home project and hence get renamed."
   group_class: project
-
-# Test Helper trims the rest of the file
-
-# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper
-
-# projects owned by user1_with_load
-<% for i in 1..301 do %>
-project_<%=i%>_of_301:
-  uuid: zzzzz-j7d0g-301gneyn6brd<%= i.to_s.rjust(3, '0') %>
-  owner_uuid: zzzzz-tpzed-user1withloadab
-  created_at: <%= i.minute.ago.to_s(:db) %>
-  name: Project_<%= i %>
-  group_class: project
-<% end %>
-
-# Do not add your fixtures below this line as the rest of this file will be trimmed by test_helper

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list