@@ -190,27 +190,27 class IssuesControllerTest < ActionController::TestCase | |||
|
190 | 190 | assert_not_nil assigns(:issues) |
|
191 | 191 | assert_not_nil assigns(:issue_count_by_group) |
|
192 | 192 | end |
|
193 | ||
|
193 | ||
|
194 | 194 | def test_private_query_should_not_be_available_to_other_users |
|
195 | 195 | q = Query.create!(:name => "private", :user => User.find(2), :is_public => false, :project => nil) |
|
196 | 196 | @request.session[:user_id] = 3 |
|
197 | ||
|
197 | ||
|
198 | 198 | get :index, :query_id => q.id |
|
199 | 199 | assert_response 403 |
|
200 | 200 | end |
|
201 | ||
|
201 | ||
|
202 | 202 | def test_private_query_should_be_available_to_its_user |
|
203 | 203 | q = Query.create!(:name => "private", :user => User.find(2), :is_public => false, :project => nil) |
|
204 | 204 | @request.session[:user_id] = 2 |
|
205 | ||
|
205 | ||
|
206 | 206 | get :index, :query_id => q.id |
|
207 | 207 | assert_response :success |
|
208 | 208 | end |
|
209 | ||
|
209 | ||
|
210 | 210 | def test_public_query_should_be_available_to_other_users |
|
211 | 211 | q = Query.create!(:name => "private", :user => User.find(2), :is_public => true, :project => nil) |
|
212 | 212 | @request.session[:user_id] = 3 |
|
213 | ||
|
213 | ||
|
214 | 214 | get :index, :query_id => q.id |
|
215 | 215 | assert_response :success |
|
216 | 216 | end |
@@ -354,11 +354,11 class IssuesControllerTest < ActionController::TestCase | |||
|
354 | 354 | assert_no_tag :option, :attributes => {:value => '15'}, |
|
355 | 355 | :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } |
|
356 | 356 | end |
|
357 | ||
|
357 | ||
|
358 | 358 | def test_update_form_should_allow_attachment_upload |
|
359 | 359 | @request.session[:user_id] = 2 |
|
360 | 360 | get :show, :id => 1 |
|
361 | ||
|
361 | ||
|
362 | 362 | assert_tag :tag => 'form', |
|
363 | 363 | :attributes => {:id => 'issue-form', :method => 'post', :enctype => 'multipart/form-data'}, |
|
364 | 364 | :descendant => { |
@@ -474,11 +474,11 class IssuesControllerTest < ActionController::TestCase | |||
|
474 | 474 | assert_no_tag :option, :attributes => {:value => '15'}, |
|
475 | 475 | :parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} } |
|
476 | 476 | end |
|
477 | ||
|
477 | ||
|
478 | 478 | def test_get_new_form_should_allow_attachment_upload |
|
479 | 479 | @request.session[:user_id] = 2 |
|
480 | 480 | get :new, :project_id => 1, :tracker_id => 1 |
|
481 | ||
|
481 | ||
|
482 | 482 | assert_tag :tag => 'form', |
|
483 | 483 | :attributes => {:id => 'issue-form', :method => 'post', :enctype => 'multipart/form-data'}, |
|
484 | 484 | :descendant => { |
@@ -559,7 +559,7 class IssuesControllerTest < ActionController::TestCase | |||
|
559 | 559 | assert_not_nil v |
|
560 | 560 | assert_equal 'Value for field 2', v.value |
|
561 | 561 | end |
|
562 | ||
|
562 | ||
|
563 | 563 | def test_post_new_with_group_assignment |
|
564 | 564 | group = Group.find(11) |
|
565 | 565 | project = Project.find(1) |
@@ -568,7 +568,7 class IssuesControllerTest < ActionController::TestCase | |||
|
568 | 568 | with_settings :issue_group_assignment => '1' do |
|
569 | 569 | @request.session[:user_id] = 2 |
|
570 | 570 | assert_difference 'Issue.count' do |
|
571 |
post :create, :project_id => project.id, |
|
|
571 | post :create, :project_id => project.id, | |
|
572 | 572 | :issue => {:tracker_id => 3, |
|
573 | 573 | :status_id => 1, |
|
574 | 574 | :subject => 'This is the test_new_with_group_assignment issue', |
@@ -576,7 +576,7 class IssuesControllerTest < ActionController::TestCase | |||
|
576 | 576 | end |
|
577 | 577 | end |
|
578 | 578 | assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id |
|
579 | ||
|
579 | ||
|
580 | 580 | issue = Issue.find_by_subject('This is the test_new_with_group_assignment issue') |
|
581 | 581 | assert_not_nil issue |
|
582 | 582 | assert_equal group, issue.assigned_to |
@@ -609,7 +609,7 class IssuesControllerTest < ActionController::TestCase | |||
|
609 | 609 | :issue => {:tracker_id => 3, :subject => 'This is first issue', :priority_id => 5}, |
|
610 | 610 | :continue => '' |
|
611 | 611 | end |
|
612 | ||
|
612 | ||
|
613 | 613 | issue = Issue.first(:order => 'id DESC') |
|
614 | 614 | assert_redirected_to :controller => 'issues', :action => 'new', :project_id => 'ecookbook', :issue => {:tracker_id => 3} |
|
615 | 615 | assert_not_nil flash[:notice], "flash was not set" |
@@ -697,7 +697,7 class IssuesControllerTest < ActionController::TestCase | |||
|
697 | 697 | assert_not_nil issue |
|
698 | 698 | assert_nil issue.parent |
|
699 | 699 | end |
|
700 | ||
|
700 | ||
|
701 | 701 | def test_post_create_private |
|
702 | 702 | @request.session[:user_id] = 2 |
|
703 | 703 | |
@@ -710,12 +710,12 class IssuesControllerTest < ActionController::TestCase | |||
|
710 | 710 | issue = Issue.first(:order => 'id DESC') |
|
711 | 711 | assert issue.is_private? |
|
712 | 712 | end |
|
713 | ||
|
713 | ||
|
714 | 714 | def test_post_create_private_with_set_own_issues_private_permission |
|
715 | 715 | role = Role.find(1) |
|
716 | 716 | role.remove_permission! :set_issues_private |
|
717 | 717 | role.add_permission! :set_own_issues_private |
|
718 | ||
|
718 | ||
|
719 | 719 | @request.session[:user_id] = 2 |
|
720 | 720 | |
|
721 | 721 | assert_difference 'Issue.count' do |
@@ -782,18 +782,18 class IssuesControllerTest < ActionController::TestCase | |||
|
782 | 782 | def test_post_create_with_attachment |
|
783 | 783 | set_tmp_attachments_directory |
|
784 | 784 | @request.session[:user_id] = 2 |
|
785 | ||
|
785 | ||
|
786 | 786 | assert_difference 'Issue.count' do |
|
787 | 787 | assert_difference 'Attachment.count' do |
|
788 |
post :create, :project_id => 1, |
|
|
788 | post :create, :project_id => 1, | |
|
789 | 789 | :issue => { :tracker_id => '1', :subject => 'With attachment' }, |
|
790 | 790 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}} |
|
791 | 791 | end |
|
792 | 792 | end |
|
793 | ||
|
793 | ||
|
794 | 794 | issue = Issue.first(:order => 'id DESC') |
|
795 | 795 | attachment = Attachment.first(:order => 'id DESC') |
|
796 | ||
|
796 | ||
|
797 | 797 | assert_equal issue, attachment.container |
|
798 | 798 | assert_equal 2, attachment.author_id |
|
799 | 799 | assert_equal 'testfile.txt', attachment.filename |
@@ -1146,14 +1146,14 class IssuesControllerTest < ActionController::TestCase | |||
|
1146 | 1146 | :notes => '', |
|
1147 | 1147 | :attachments => {'1' => {'file' => uploaded_test_file('testfile.txt', 'text/plain'), 'description' => 'test file'}} |
|
1148 | 1148 | end |
|
1149 | ||
|
1149 | ||
|
1150 | 1150 | assert_redirected_to :action => 'show', :id => '1' |
|
1151 | 1151 | j = Issue.find(1).journals.find(:first, :order => 'id DESC') |
|
1152 | 1152 | assert j.notes.blank? |
|
1153 | 1153 | assert_equal 1, j.details.size |
|
1154 | 1154 | assert_equal 'testfile.txt', j.details.first.value |
|
1155 | 1155 | assert_equal User.anonymous, j.user |
|
1156 | ||
|
1156 | ||
|
1157 | 1157 | attachment = Attachment.first(:order => 'id DESC') |
|
1158 | 1158 | assert_equal Issue.find(1), attachment.container |
|
1159 | 1159 | assert_equal User.anonymous, attachment.author |
@@ -1396,7 +1396,7 class IssuesControllerTest < ActionController::TestCase | |||
|
1396 | 1396 | group = Group.find(11) |
|
1397 | 1397 | project = Project.find(1) |
|
1398 | 1398 | project.members << Member.new(:principal => group, :roles => [Role.first]) |
|
1399 | ||
|
1399 | ||
|
1400 | 1400 | @request.session[:user_id] = 2 |
|
1401 | 1401 | # update issues assignee |
|
1402 | 1402 | post :bulk_update, :ids => [1, 2], :notes => 'Bulk editing', |
General Comments 0
You need to be logged in to leave comments.
Login now