aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2024-08-05 18:32:29 +0200
committerGitHub <noreply@github.com>2024-08-05 18:32:29 +0200
commita0c5b12e8291e40cf43c61844d50a5f7fdfe021a (patch)
treedd50462e9368acf5e375ded8e5ac3a23ba7f45e1
parentcd41c45d917d18839ab800816070db09a359d5bf (diff)
downloadjquery-ui-a0c5b12e8291e40cf43c61844d50a5f7fdfe021a.tar.gz
jquery-ui-a0c5b12e8291e40cf43c61844d50a5f7fdfe021a.zip
Build: Bump actions/setup-node from 4.0.2 to 4.0.3 in the github-actions group
Bumps the github-actions group with 1 update: [actions/setup-node](https://github.com/actions/setup-node). Updates `actions/setup-node` from 4.0.2 to 4.0.3 - [Release notes](https://github.com/actions/setup-node/releases) - [Commits](https://github.com/actions/setup-node/compare/60edb5dd545a775178f52524783378180af0d1f8...1e60f620b9541d16bece96c5465dc8ee9832be0b) Closes gh-2276 --- updated-dependencies: - dependency-name: actions/setup-node dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
-rw-r--r--.github/workflows/filestash.yml2
-rw-r--r--.github/workflows/node.js.yml6
2 files changed, 4 insertions, 4 deletions
diff --git a/.github/workflows/filestash.yml b/.github/workflows/filestash.yml
index 487644ee9..be4383484 100644
--- a/.github/workflows/filestash.yml
+++ b/.github/workflows/filestash.yml
@@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js ${{ env.NODE_VERSION }}
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml
index 3e2bcda40..84e1db718 100644
--- a/.github/workflows/node.js.yml
+++ b/.github/workflows/node.js.yml
@@ -34,7 +34,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js ${{ env.NODE_VERSION }}
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
@@ -78,7 +78,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js ${{ env.NODE_VERSION }}
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
@@ -119,7 +119,7 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Use Node.js ${{ env.NODE_VERSION }}
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
+ uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
with:
node-version: ${{ env.NODE_VERSION }}
id='n250' href='#n250'>250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292
# frozen_string_literal: true

# Redmine - project management software
# Copyright (C) 2006-  Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

require_relative '../test_helper'

class GroupsControllerTest < Redmine::ControllerTest
  fixtures :projects, :users, :members, :member_roles, :roles, :groups_users

  def setup
    @request.session[:user_id] = 1
  end

  def test_index
    get :index
    assert_response :success
    assert_select 'table.groups'
  end

  def test_index_should_show_user_count
    get :index
    assert_response :success
    assert_select 'tr#group-11 td.user_count', :text => '1'
  end

  def test_index_with_name_filter
    Group.generate!(:name => "Clients")
    get(:index, :params => {:name => "cli"})
    assert_response :success
    assert_select 'table.groups tbody tr', 1
    assert_select 'table.groups tbody td.name', :text => 'Clients'
  end

  def test_show
    Role.anonymous.update! :users_visibility => 'all'

    @request.session[:user_id] = nil
    get(:show, :params => {:id => 10})
    assert_response :success

    assert_select 'li a.user.active[href=?]', '/users/8', :text => 'User Misc'
  end

  def test_show_should_display_custom_fields
    GroupCustomField.generate!(name: 'field_visible', visible: true)
    Group.find(10).update(custom_field_values: {GroupCustomField.last.id => 'value_visible'})
    GroupCustomField.generate!(name: 'field_invisible', visible: false)
    Group.find(10).update(custom_field_values: {GroupCustomField.last.id => 'value_invisible'})
    get :show, :params => {:id => 10}
    assert_response :success

    assert_select 'li', :text => /field_visible/
    assert_select 'li', :text => /value_visible/
    assert_select 'li', :text => /field_invisible/, :count => 0
    assert_select 'li', :text => /value_invisible/, :count => 0
  end

  def test_show_invalid_should_return_404
    get(:show, :params => {:id => 99})
    assert_response :not_found
  end

  def test_show_group_that_is_not_visible_should_return_404
    Role.anonymous.update! :users_visibility => 'members_of_visible_projects'

    @request.session[:user_id] = nil
    get :show, :params => {:id => 10}
    assert_response :not_found
  end

  def test_show_should_display_only_visible_users
    group = Group.find(10)
    locked_user = User.find(5)
    group.users << locked_user
    assert locked_user.locked?

    @request.session[:user_id] = nil
    get :show, :params => {:id => group.id}
    assert_response :success

    assert_select 'li', :text => 'User Misc'
    assert_select 'li', :text => locked_user.name, :count => 0
  end

  def test_new
    get :new
    assert_response :success
    assert_select 'input[name=?]', 'group[name]'
  end

  def test_create
    assert_difference 'Group.count' do
      post(
        :create, :params => {
          :group => {
            :name => 'New group'
          }
        }
      )
    end
    assert_redirected_to '/groups'
    group = Group.order('id DESC').first
    assert_equal 'New group', group.name
    assert_equal [], group.users
  end

  def test_create_and_continue
    assert_difference 'Group.count' do
      post(
        :create,
        :params => {
          :group => {
            :name => 'New group'
          },
          :continue => 'Create and continue'
        }
      )
    end
    assert_redirected_to '/groups/new'
    group = Group.order('id DESC').first
    assert_equal 'New group', group.name
  end

  def test_create_with_failure
    assert_no_difference 'Group.count' do
      post(
        :create,
        :params => {
          :group => {
            :name => ''
          }
        }
      )
    end
    assert_response :success
    assert_select_error /Name cannot be blank/i
  end

  def test_edit
    get(
      :edit,
      :params => {
        :id => 10
      }
    )
    assert_response :success

    assert_select 'div#tab-content-users'
    assert_select 'div#tab-content-memberships' do
      assert_select 'a', :text => 'Private child of eCookbook'
    end
  end

  def test_update
    new_name = 'New name'
    put(
      :update,
      :params => {
        :id => 10,
        :group => {
          :name => new_name
        }
      }
    )
    assert_redirected_to '/groups'
    group = Group.find(10)
    assert_equal new_name, group.name
  end

  def test_update_with_failure
    put(
      :update,
      :params => {
        :id => 10,
        :group => {
          :name => ''
        }
      }
    )
    assert_response :success
    assert_select_error /Name cannot be blank/i
  end

  def test_destroy
    assert_difference 'Group.count', -1 do
      post(:destroy, :params => {:id => 10})
    end
    assert_redirected_to '/groups'
  end

  def test_new_users
    get(:new_users, :params => {:id => 10})
    assert_response :success
    assert_select 'input[name=?]', 'user_search'
  end

  def test_xhr_new_users
    get(
      :new_users,
      :params => {
        :id => 10
      },
      :xhr => true
    )
    assert_response :success
    assert_equal 'text/javascript', response.media_type
  end

  def test_add_users
    assert_difference 'Group.find(10).users.count', 2 do
      post(
        :add_users,
        :params => {
          :id => 10,
          :user_ids => ['2', '3']
        }
      )
    end
  end

  def test_xhr_add_users
    assert_difference 'Group.find(10).users.count', 2 do
      post(
        :add_users,
        :params => {
          :id => 10,
          :user_ids => ['2', '3']
        },
        :xhr => true
      )
      assert_response :success
      assert_equal 'text/javascript', response.media_type
    end
    assert_match /John Smith/, response.body
  end

  def test_remove_user
    assert_difference 'Group.find(10).users.count', -1 do
      delete(
        :remove_user,
        :params => {
          :id => 10,
          :user_id => '8'
        }
      )
    end
  end

  def test_xhr_remove_user
    assert_difference 'Group.find(10).users.count', -1 do
      delete(
        :remove_user,
        :params => {
          :id => 10,
          :user_id => '8'
        },
        :xhr => true
      )
      assert_response :success
      assert_equal 'text/javascript', response.media_type
    end
  end

  def test_autocomplete_for_user
    get(
      :autocomplete_for_user,
      :params => {
        :id => 10,
        :q => 'smi',
        :format => 'js'
      },
      :xhr => true
    )
    assert_response :success
    assert_include 'John Smith', response.body
  end
end