To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / cb / cb9498d4606605e6e97dd345a7fb3ba9d914a73a.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (1.95 KB)
| 1 |
# Redmine - project management software |
|---|---|
| 2 |
# Copyright (C) 2006-2011 Jean-Philippe Lang |
| 3 |
# |
| 4 |
# This program is free software; you can redistribute it and/or |
| 5 |
# modify it under the terms of the GNU General Public License |
| 6 |
# as published by the Free Software Foundation; either version 2 |
| 7 |
# of the License, or (at your option) any later version. |
| 8 |
# |
| 9 |
# This program is distributed in the hope that it will be useful, |
| 10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
# GNU General Public License for more details. |
| 13 |
# |
| 14 |
# You should have received a copy of the GNU General Public License |
| 15 |
# along with this program; if not, write to the Free Software |
| 16 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 |
|
| 18 |
require File.expand_path('../../../test_helper', __FILE__)
|
| 19 |
|
| 20 |
class ApiTest::QueriesTest < ActionController::IntegrationTest |
| 21 |
fixtures :projects, :trackers, :issue_statuses, :issues, |
| 22 |
:enumerations, :users, :issue_categories, |
| 23 |
:projects_trackers, |
| 24 |
:roles, |
| 25 |
:member_roles, |
| 26 |
:members, |
| 27 |
:enabled_modules, |
| 28 |
:workflows, |
| 29 |
:queries |
| 30 |
|
| 31 |
def setup |
| 32 |
Setting.rest_api_enabled = '1' |
| 33 |
end |
| 34 |
|
| 35 |
context "/queries" do |
| 36 |
context "GET" do |
| 37 |
|
| 38 |
should "return queries" do |
| 39 |
get '/queries.xml' |
| 40 |
|
| 41 |
assert_response :success |
| 42 |
assert_equal 'application/xml', @response.content_type |
| 43 |
assert_tag :tag => 'queries', |
| 44 |
:attributes => {:type => 'array'},
|
| 45 |
:child => {
|
| 46 |
:tag => 'query', |
| 47 |
:child => {
|
| 48 |
:tag => 'id', |
| 49 |
:content => '4', |
| 50 |
:sibling => {
|
| 51 |
:tag => 'name', |
| 52 |
:content => 'Public query for all projects' |
| 53 |
} |
| 54 |
} |
| 55 |
} |
| 56 |
end |
| 57 |
end |
| 58 |
end |
| 59 |
|
| 60 |
def credentials(user, password=nil) |
| 61 |
ActionController::HttpAuthentication::Basic.encode_credentials(user, password || user) |
| 62 |
end |
| 63 |
end |