##// END OF EJS Templates
Makes projects API return XML description when creating a project (#6874)....
Jean-Philippe Lang -
r4283:eaab2ede76c9
parent child
Show More
@@ -93,7 +93,7 class ProjectsController < ApplicationController
93 flash[:notice] = l(:notice_successful_create)
93 flash[:notice] = l(:notice_successful_create)
94 redirect_to :controller => 'projects', :action => 'settings', :id => @project
94 redirect_to :controller => 'projects', :action => 'settings', :id => @project
95 }
95 }
96 format.xml { head :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
96 format.xml { render :action => 'show', :status => :created, :location => url_for(:controller => 'projects', :action => 'show', :id => @project.id) }
97 end
97 end
98 else
98 else
99 respond_to do |format|
99 respond_to do |format|
@@ -106,6 +106,10 class ApiTest::IssuesTest < ActionController::IntegrationTest
106 assert_equal 2, issue.tracker_id
106 assert_equal 2, issue.tracker_id
107 assert_equal 3, issue.status_id
107 assert_equal 3, issue.status_id
108 assert_equal 'API test', issue.subject
108 assert_equal 'API test', issue.subject
109
110 assert_response :created
111 assert_equal 'application/xml', @response.content_type
112 assert_tag 'issue', :child => {:tag => 'id', :content => issue.id.to_s}
109 end
113 end
110 end
114 end
111
115
@@ -52,12 +52,15 class ApiTest::ProjectsTest < ActionController::IntegrationTest
52 assert_difference 'Project.count' do
52 assert_difference 'Project.count' do
53 post '/projects.xml', {:project => attributes}, :authorization => credentials('admin')
53 post '/projects.xml', {:project => attributes}, :authorization => credentials('admin')
54 end
54 end
55 assert_response :created
55
56 assert_equal 'application/xml', @response.content_type
57 project = Project.first(:order => 'id DESC')
56 project = Project.first(:order => 'id DESC')
58 attributes.each do |attribute, value|
57 attributes.each do |attribute, value|
59 assert_equal value, project.send(attribute)
58 assert_equal value, project.send(attribute)
60 end
59 end
60
61 assert_response :created
62 assert_equal 'application/xml', @response.content_type
63 assert_tag 'project', :child => {:tag => 'id', :content => project.id.to_s}
61 end
64 end
62
65
63 def test_create_failure
66 def test_create_failure
General Comments 0
You need to be logged in to leave comments. Login now