summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-03 13:32:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-03 13:32:14 +0000
commit327d5d2132ace260e93b3a47c97d6eb1b0f6ef31 (patch)
treee30cdc2c0a673c34a08e4912d608e67623f3ad0d
parent1c5b2140566fec0a3d464edc9b1baebebc086240 (diff)
downloadredmine-327d5d2132ace260e93b3a47c97d6eb1b0f6ef31.tar.gz
redmine-327d5d2132ace260e93b3a47c97d6eb1b0f6ef31.zip
Makes users optional in GET /groups/:id (#8981).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9765 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r--app/views/groups/show.api.rsb2
-rw-r--r--test/integration/api_test/groups_test.rb9
2 files changed, 10 insertions, 1 deletions
diff --git a/app/views/groups/show.api.rsb b/app/views/groups/show.api.rsb
index 764bdceda..626474410 100644
--- a/app/views/groups/show.api.rsb
+++ b/app/views/groups/show.api.rsb
@@ -8,7 +8,7 @@ api.group do
@group.users.each do |user|
api.user :id => user.id, :name => user.name
end
- end
+ end if include_in_api_response?('users')
api.array :memberships do
@group.memberships.each do |membership|
diff --git a/test/integration/api_test/groups_test.rb b/test/integration/api_test/groups_test.rb
index fdc7983dd..9fbcb02d2 100644
--- a/test/integration/api_test/groups_test.rb
+++ b/test/integration/api_test/groups_test.rb
@@ -76,6 +76,15 @@ class ApiTest::GroupsTest < ActionController::IntegrationTest
assert_select 'group' do
assert_select 'name', :text => 'A Team'
assert_select 'id', :text => '10'
+ end
+ end
+
+ should "include users if requested" do
+ get '/groups/10.xml?include=users', {}, credentials('admin')
+ assert_response :success
+ assert_equal 'application/xml', response.content_type
+
+ assert_select 'group' do
assert_select 'users' do
assert_select 'user', Group.find(10).users.count
assert_select 'user[id=8]'