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