diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-11-20 14:25:58 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-11-20 14:25:58 +0000 |
commit | 248b7258751cd7e41bc84f5ed9d18f05dc8413c3 (patch) | |
tree | 1114c99868803ac2d35535d98f4287f7fac6abcc /test | |
parent | 053adaef52d795e5a3ef134381dd378e40856775 (diff) | |
download | redmine-248b7258751cd7e41bc84f5ed9d18f05dc8413c3.tar.gz redmine-248b7258751cd7e41bc84f5ed9d18f05dc8413c3.zip |
Adds API response to /issue_statuses to get the list of all available statuses (#7180).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7878 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/issue_statuses_controller_test.rb | 12 | ||||
-rw-r--r-- | test/integration/api_test/issue_statuses_test.rb | 51 |
2 files changed, 63 insertions, 0 deletions
diff --git a/test/functional/issue_statuses_controller_test.rb b/test/functional/issue_statuses_controller_test.rb index c03f30866..d49232605 100644 --- a/test/functional/issue_statuses_controller_test.rb +++ b/test/functional/issue_statuses_controller_test.rb @@ -21,6 +21,18 @@ class IssueStatusesControllerTest < ActionController::TestCase assert_response :success assert_template 'index' end + + def test_index_by_anonymous_should_redirect_to_login_form + @request.session[:user_id] = nil + get :index + assert_redirected_to '/login?back_url=http%3A%2F%2Ftest.host%2Fissue_statuses' + end + + def test_index_by_user_should_respond_with_406 + @request.session[:user_id] = 2 + get :index + assert_response 406 + end def test_new get :new diff --git a/test/integration/api_test/issue_statuses_test.rb b/test/integration/api_test/issue_statuses_test.rb new file mode 100644 index 000000000..ed5996bbe --- /dev/null +++ b/test/integration/api_test/issue_statuses_test.rb @@ -0,0 +1,51 @@ +# Redmine - project management software +# Copyright (C) 2006-2011 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 File.expand_path('../../../test_helper', __FILE__) + +class ApiTest::IssueStatusesTest < ActionController::IntegrationTest + fixtures :issue_statuses + + def setup + Setting.rest_api_enabled = '1' + end + + context "/issue_statuses" do + context "GET" do + + should "return issue statuses" do + get '/issue_statuses.xml' + + assert_response :success + assert_equal 'application/xml', @response.content_type + assert_tag :tag => 'issue_statuses', + :attributes => {:type => 'array'}, + :child => { + :tag => 'issue_status', + :child => { + :tag => 'id', + :content => '2', + :sibling => { + :tag => 'name', + :content => 'Assigned' + } + } + } + end + end + end +end |