Project

General

Profile

Defect #35634 » 0001-Adds-tests-for-issue-attachment-edit-by-user-without.patch

Marius BĂLTEANU, 2021-08-01 13:32

View differences:

test/functional/attachments_controller_test.rb
524 524
    assert_response 403
525 525
  end
526 526

  
527
  def test_edit_all_issue_attachment_by_user_without_edit_issue_permission_on_tracker_should_return_404
528
    role = Role.find(2)
529
    role.set_permission_trackers 'edit_issues', [2, 3]
530
    role.save!
531

  
532
    @request.session[:user_id] = 2
533

  
534
    get(
535
      :edit_all,
536
      :params => {
537
        :object_type => 'issues',
538
        :object_id => '4'
539
      }
540
    )
541
    assert_response 404
542
  end
543

  
527 544
  def test_update_all
528 545
    @request.session[:user_id] = 2
529 546
    patch(
test/functional/issues_controller_test.rb
3157 3157
    assert_select 'span.badge.badge-private', text: 'Private'
3158 3158
  end
3159 3159

  
3160
  def test_show_should_not_display_edit_attachment_icon_for_user_without_edit_issue_permission_on_tracker
3161
      role = Role.find(2)
3162
      role.set_permission_trackers 'edit_issues', [2, 3]
3163
      role.save!
3164

  
3165
      @request.session[:user_id] = 2
3166

  
3167
      get :show, params: {id: 4}
3168

  
3169
      assert_response :success
3170
      assert_select 'div.attachments .icon-edit',  0
3171
  end
3172

  
3160 3173
  def test_get_new
3161 3174
    @request.session[:user_id] = 2
3162 3175
    get(
(2-2/2)