summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test/projects_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2020-03-17 08:59:21 +0000
committerGo MAEDA <maeda@farend.jp>2020-03-17 08:59:21 +0000
commit348df5f978bed97342c661c4bdb47ab43f2096ce (patch)
tree909d57286b1e3682a9acb945aa803028952cdf7c /test/integration/api_test/projects_test.rb
parent7c608f9f4aab243e4417f6e12c8426ef00924dbc (diff)
downloadredmine-348df5f978bed97342c661c4bdb47ab43f2096ce.tar.gz
redmine-348df5f978bed97342c661c4bdb47ab43f2096ce.zip
Show default assignee and default version in projects API (#33113).
Patch by Marius BALTEANU. git-svn-id: http://svn.redmine.org/redmine/trunk@19581 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test/projects_test.rb')
-rw-r--r--test/integration/api_test/projects_test.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index 39d7dccd5..2e4e73c3a 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -108,6 +108,8 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_kind_of Hash, json['project']
assert_equal 1, json['project']['id']
assert_equal false, json['project']['inherit_members']
+ assert_equal false, json['project'].has_key?('default_version')
+ assert_equal false, json['project'].has_key?('default_assignee')
end
test "GET /projects/:id.xml with hidden custom fields should not display hidden custom fields" do
@@ -152,6 +154,29 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
assert_select 'enabled_modules[type=array] enabled_module[name=issue_tracking]'
end
+ def test_get_project_with_default_version_and_assignee
+ user = User.find(3)
+ version = Version.find(1)
+ Project.find(1).update!(default_assigned_to_id: user.id, default_version_id: version.id)
+
+ get '/projects/1.json'
+
+ json = ActiveSupport::JSON.decode(response.body)
+ assert_kind_of Hash, json
+ assert_kind_of Hash, json['project']
+ assert_equal 1, json['project']['id']
+
+ assert json['project'].has_key?('default_assignee')
+ assert_equal 2, json['project']['default_assignee'].length
+ assert_equal user.id, json['project']['default_assignee']['id']
+ assert_equal user.name, json['project']['default_assignee']['name']
+
+ assert json['project'].has_key?('default_version')
+ assert_equal 2, json['project']['default_version'].length
+ assert_equal version.id, json['project']['default_version']['id']
+ assert_equal version.name, json['project']['default_version']['name']
+ end
+
test "POST /projects.xml with valid parameters should create the project" do
with_settings :default_projects_modules => ['issue_tracking', 'repository'] do
assert_difference('Project.count') do