comparison test/integration/api_test/users_test.rb @ 128:07fa8a8b56a8

Update to Redmine trunk rev 4732
author Chris Cannam
date Wed, 19 Jan 2011 15:04:22 +0000
parents 8661b858af72
children cbce1fd3b1b7
comparison
equal deleted inserted replaced
119:8661b858af72 128:07fa8a8b56a8
243 assert json.has_key?('errors') 243 assert json.has_key?('errors')
244 assert_kind_of Array, json['errors'] 244 assert_kind_of Array, json['errors']
245 end 245 end
246 end 246 end
247 end 247 end
248 248 end
249 context "DELETE /users/2" do 249
250 context ".xml" do 250 context "DELETE /users/2" do
251 should "not be allowed" do 251 context ".xml" do
252 assert_no_difference('User.count') do 252 should_allow_api_authentication(:delete,
253 delete '/users/2.xml' 253 '/users/2.xml',
254 end 254 {},
255 255 {:success_code => :ok})
256 assert_response :method_not_allowed 256
257 end 257 should "delete user" do
258 end 258 assert_difference('User.count', -1) do
259 259 delete '/users/2.xml', {}, :authorization => credentials('admin')
260 context ".json" do 260 end
261 should "not be allowed" do 261
262 assert_no_difference('User.count') do 262 assert_response :ok
263 delete '/users/2.json' 263 end
264 end 264 end
265 265
266 assert_response :method_not_allowed 266 context ".json" do
267 end 267 should_allow_api_authentication(:delete,
268 '/users/2.xml',
269 {},
270 {:success_code => :ok})
271
272 should "delete user" do
273 assert_difference('User.count', -1) do
274 delete '/users/2.json', {}, :authorization => credentials('admin')
275 end
276
277 assert_response :ok
268 end 278 end
269 end 279 end
270 end 280 end
271 281
272 def credentials(user, password=nil) 282 def credentials(user, password=nil)