summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/views/projects/index.api.rsb1
-rw-r--r--app/views/projects/show.api.rsb1
-rw-r--r--test/integration/api_test/projects_test.rb18
3 files changed, 17 insertions, 3 deletions
diff --git a/app/views/projects/index.api.rsb b/app/views/projects/index.api.rsb
index d309af241..03c7c0c77 100644
--- a/app/views/projects/index.api.rsb
+++ b/app/views/projects/index.api.rsb
@@ -8,6 +8,7 @@ api.array :projects, api_meta(:total_count => @project_count, :offset => @offset
api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible?
api.status project.status
api.is_public project.is_public?
+ api.inherit_members project.inherit_members?
render_api_custom_values project.visible_custom_field_values, api
render_api_includes(project, api)
diff --git a/app/views/projects/show.api.rsb b/app/views/projects/show.api.rsb
index 6e1958a34..240b18883 100644
--- a/app/views/projects/show.api.rsb
+++ b/app/views/projects/show.api.rsb
@@ -7,6 +7,7 @@ api.project do
api.parent(:id => @project.parent.id, :name => @project.parent.name) if @project.parent && @project.parent.visible?
api.status @project.status
api.is_public @project.is_public?
+ api.inherit_members @project.inherit_members?
render_api_custom_values @project.visible_custom_field_values, api
render_api_includes(@project, api)
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index ee5c53a7c..6c7496fc4 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -30,13 +30,20 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
end
test "GET /projects.xml should return projects" do
+ project = Project.find(1)
+ project.inherit_members = '1'
+ project.save!
+
get '/projects.xml'
assert_response :success
assert_equal 'application/xml', @response.content_type
- assert_select 'projects>project>id', :text => '1'
- assert_select 'projects>project>status', :text => '1'
- assert_select 'projects>project>is_public', :text => 'true'
+ assert_select 'projects>project:first-child' do
+ assert_select '>id', :text => '1'
+ assert_select '>status', :text => '1'
+ assert_select '>is_public', :text => 'true'
+ assert_select '>inherit_members', :text => 'true'
+ end
end
test "GET /projects.json should return projects" do
@@ -49,6 +56,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_kind_of Array, json['projects']
assert_kind_of Hash, json['projects'].first
assert json['projects'].first.has_key?('id')
+ assert json['projects'].first.has_key?('inherit_members')
end
test "GET /projects.xml with include=issue_categories should return categories" do
@@ -76,6 +84,8 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
end
test "GET /projects/:id.xml should return the project" do
+ Project.find(1).update!(:inherit_members => '1')
+
get '/projects/1.xml'
assert_response :success
assert_equal 'application/xml', @response.content_type
@@ -83,6 +93,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_select 'project>id', :text => '1'
assert_select 'project>status', :text => '1'
assert_select 'project>is_public', :text => 'true'
+ assert_select 'project>inherit_members', :text => 'true'
assert_select 'custom_field[name="Development status"]', :text => 'Stable'
assert_select 'trackers', 0
@@ -96,6 +107,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_kind_of Hash, json
assert_kind_of Hash, json['project']
assert_equal 1, json['project']['id']
+ assert_equal false, json['project']['inherit_members']
end
test "GET /projects/:id.xml with hidden custom fields should not display hidden custom fields" do