summaryrefslogtreecommitdiffstats
path: root/test/integration/api_test/projects_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-06 20:36:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-01-06 20:36:31 +0000
commit9fb770ba503b3dfe1fe48794e1b7042c5e26d8d7 (patch)
tree7a7975f365ca85a2472811908a3292f5a8d1a9a7 /test/integration/api_test/projects_test.rb
parent7620142b7015860e11afb696f67877f03323a8a0 (diff)
downloadredmine-9fb770ba503b3dfe1fe48794e1b7042c5e26d8d7.tar.gz
redmine-9fb770ba503b3dfe1fe48794e1b7042c5e26d8d7.zip
Moves enabled_module_names param to project attribute so that it can be set through the Project API.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4645 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/api_test/projects_test.rb')
-rw-r--r--test/integration/api_test/projects_test.rb47
1 files changed, 46 insertions, 1 deletions
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index e40d6584a..6258aae89 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -122,12 +122,35 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
project = Project.first(:order => 'id DESC')
assert_equal 'API test', project.name
assert_equal 'api-test', project.identifier
- assert_equal ['issue_tracking', 'repository'], project.enabled_module_names
+ assert_equal ['issue_tracking', 'repository'], project.enabled_module_names.sort
+ assert_equal Tracker.all.size, project.trackers.size
assert_response :created
assert_equal 'application/xml', @response.content_type
assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s}
end
+
+ should "accept enabled_module_names attribute" do
+ @parameters[:project].merge!({:enabled_module_names => ['issue_tracking', 'news', 'time_tracking']})
+
+ assert_difference('Project.count') do
+ post '/projects.xml', @parameters, :authorization => credentials('admin')
+ end
+
+ project = Project.first(:order => 'id DESC')
+ assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort
+ end
+
+ should "accept tracker_ids attribute" do
+ @parameters[:project].merge!({:tracker_ids => [1, 3]})
+
+ assert_difference('Project.count') do
+ post '/projects.xml', @parameters, :authorization => credentials('admin')
+ end
+
+ project = Project.first(:order => 'id DESC')
+ assert_equal [1, 3], project.trackers.map(&:id).sort
+ end
end
end
@@ -171,6 +194,28 @@ class ApiTest::ProjectsTest < ActionController::IntegrationTest
project = Project.find(2)
assert_equal 'API update', project.name
end
+
+ should "accept enabled_module_names attribute" do
+ @parameters[:project].merge!({:enabled_module_names => ['issue_tracking', 'news', 'time_tracking']})
+
+ assert_no_difference 'Project.count' do
+ put '/projects/2.xml', @parameters, :authorization => credentials('admin')
+ end
+ assert_response :ok
+ project = Project.find(2)
+ assert_equal ['issue_tracking', 'news', 'time_tracking'], project.enabled_module_names.sort
+ end
+
+ should "accept tracker_ids attribute" do
+ @parameters[:project].merge!({:tracker_ids => [1, 3]})
+
+ assert_no_difference 'Project.count' do
+ put '/projects/2.xml', @parameters, :authorization => credentials('admin')
+ end
+ assert_response :ok
+ project = Project.find(2)
+ assert_equal [1, 3], project.trackers.map(&:id).sort
+ end
end
end