[ARVADOS] updated: e59b42354a10079ecd579a1dbe53c39a20d05313

git at public.curoverse.com git at public.curoverse.com
Wed Jul 15 08:24:13 EDT 2015


Summary of changes:
 .../test/controllers/projects_controller_test.rb   | 13 ++++++-
 .../test/controllers/users_controller_test.rb      | 45 ++++++++++++++++++++++
 apps/workbench/test/integration/users_test.rb      | 40 -------------------
 3 files changed, 57 insertions(+), 41 deletions(-)

       via  e59b42354a10079ecd579a1dbe53c39a20d05313 (commit)
      from  5106490f8cb4d3e6aaa8da2ae46283c1ef64a027 (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 e59b42354a10079ecd579a1dbe53c39a20d05313
Author: Manoj <jonam33 at gmail.com>
Date:   Wed Jul 15 08:22:16 2015 -0400

    6465-Added tests to project_controllers_test and users_controller
    test and removed tests from users_test.

diff --git a/apps/workbench/test/controllers/projects_controller_test.rb b/apps/workbench/test/controllers/projects_controller_test.rb
index ba4188e..a036a8f 100644
--- a/apps/workbench/test/controllers/projects_controller_test.rb
+++ b/apps/workbench/test/controllers/projects_controller_test.rb
@@ -353,8 +353,19 @@ class ProjectsControllerTest < ActionController::TestCase
   test "project viewer can't see project sharing tab" do
     project = api_fixture('groups')['aproject']
     get(:show, {id: project['uuid']}, session_for(:project_viewer))
-    refute_includes @response.body, '<div id ="Sharing"'
+    refute_includes @response.body, '<div id="Sharing"'
     assert_includes @response.body, '<div id="Data_collections"'
   end
 
+  [
+    'admin',
+    'active',
+  ].each do |username|
+    test "#{username} can see project sharing tab" do
+     project = api_fixture('groups')['aproject']
+     get(:show, {id: project['uuid']}, session_for(username))
+     assert_includes @response.body, '<div id="Sharing"'
+     assert_includes @response.body, '<div id="Data_collections"'
+    end
+  end
 end
diff --git a/apps/workbench/test/controllers/users_controller_test.rb b/apps/workbench/test/controllers/users_controller_test.rb
index c1436da..f439d6e 100644
--- a/apps/workbench/test/controllers/users_controller_test.rb
+++ b/apps/workbench/test/controllers/users_controller_test.rb
@@ -1,6 +1,7 @@
 require 'test_helper'
 
 class UsersControllerTest < ActionController::TestCase
+
   test "valid token works in controller test" do
     get :index, {}, session_for(:active)
     assert_response :success
@@ -74,4 +75,48 @@ class UsersControllerTest < ActionController::TestCase
     end
     assert_equal 1, found_email, "Expected 1 email after requesting shell access"
   end
+
+  [
+    'admin',
+    'active',
+  ].each do |username|
+    test "access users page as #{username} and verify show button is available" do
+      admin_user = api_fixture('users','admin')
+      active_user = api_fixture('users','active')
+      get :index, {}, session_for(username)
+      if username == 'admin'
+        assert_match /<a href="\/projects\/#{admin_user['uuid']}">Home<\/a.*./, @response.body
+        assert_match /<a href="\/projects\/#{active_user['uuid']}">Home<\/a.*./, @response.body
+        assert_match /<a.*href="\/users\/#{admin_user['uuid']}".*Show<\/a.*./, @response.body
+        assert_match /<a.*href="\/users\/#{active_user['uuid']}".*Show<\/a.*./, @response.body
+        assert_includes @response.body, admin_user['email']
+        assert_includes @response.body, active_user['email']
+      else
+        refute_match  /a href=.*Home<.*\/a.*./, @response.body
+        refute_match /<a.*href="\/users\/#{admin_user['uuid']}".*Show<\/a.*./, @response.body
+        assert_match /<a.*href="\/users\/#{active_user['uuid']}".*Show<\/a.*./, @response.body
+        assert_includes @response.body, active_user['email']
+      end
+    end
+  end
+
+  [
+    'admin',
+    'active',
+  ].each do |username|
+    test "access settings drop down menu as #{username}" do
+      admin_user = api_fixture('users','admin')
+      active_user = api_fixture('users','active')
+      get :show, {
+        id: api_fixture('users')[username]['uuid']
+      }, session_for(username)
+      if username == 'admin'
+        assert_includes @response.body, admin_user['email']
+        refute_empty css_select('[id="system-menu"]')
+      else
+        assert_includes @response.body, active_user['email']
+        assert_empty css_select('[id="system-menu"]')
+      end
+    end
+  end
 end
diff --git a/apps/workbench/test/integration/users_test.rb b/apps/workbench/test/integration/users_test.rb
index db67081..1ae302c 100644
--- a/apps/workbench/test/integration/users_test.rb
+++ b/apps/workbench/test/integration/users_test.rb
@@ -197,44 +197,4 @@ class UsersTest < ActionDispatch::IntegrationTest
     click_link 'Metadata'
     assert page.has_text? 'VirtualMachine: testvm.shell'
   end
-
-  [
-    'admin',
-    'active',
-  ].each do |username|
-    test "login as #{username} and access show button" do
-      need_javascript
-
-      user = api_fixture('users', username)
-
-      visit page_with_token(username, '/users')
-
-      within('tr', text: user['uuid']) do
-        assert_text user['email']
-        if username == 'admin'
-          assert_selector 'a', text: 'Home'
-        else
-          assert_no_selector 'a', text: 'Home'
-        end
-        assert_selector 'a', text: 'Show'
-        find('a', text: 'Show').click
-      end
-      assert_selector 'a', text: 'Attributes'
-    end
-  end
-
-  test "admin user can access another user page" do
-    need_javascript
-
-    visit page_with_token('admin', '/users')
-
-    active_user = api_fixture('users', 'active')
-    within('tr', text: active_user['uuid']) do
-      assert_text active_user['email']
-      assert_selector "a[href=\"/projects/#{active_user['uuid']}\"]", text: 'Home'
-      assert_selector 'a', text: 'Show'
-      find('a', text: 'Show').click
-    end
-    assert_selector 'a', text:'Attributes'
-  end
 end

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list