Merge remote-tracking branch 'upstream/pull/2175'

This commit is contained in:
Tom Hughes 2019-03-26 19:14:04 +00:00
commit dcfe326f65
10 changed files with 46 additions and 59 deletions

View file

@ -165,12 +165,10 @@ module Api
# check that a changeset that doesn't exist returns an appropriate message
def test_show_not_found
[0, -32, 233455644, "afg", "213"].each do |id|
begin
get :show, :params => { :id => id }
assert_response :not_found, "should get a not found"
rescue ActionController::UrlGenerationError => ex
assert_match(/No route matches/, ex.to_s)
end
get :show, :params => { :id => id }
assert_response :not_found, "should get a not found"
rescue ActionController::UrlGenerationError => ex
assert_match(/No route matches/, ex.to_s)
end
end
@ -239,23 +237,19 @@ module Api
# First try to do it with no auth
cs_ids.each do |id|
begin
put :close, :params => { :id => id }
assert_response :unauthorized, "Shouldn't be able close the non-existant changeset #{id}, when not authorized"
rescue ActionController::UrlGenerationError => ex
assert_match(/No route matches/, ex.to_s)
end
put :close, :params => { :id => id }
assert_response :unauthorized, "Shouldn't be able close the non-existant changeset #{id}, when not authorized"
rescue ActionController::UrlGenerationError => ex
assert_match(/No route matches/, ex.to_s)
end
# Now try with auth
basic_authorization create(:user).email, "test"
cs_ids.each do |id|
begin
put :close, :params => { :id => id }
assert_response :not_found, "The changeset #{id} doesn't exist, so can't be closed"
rescue ActionController::UrlGenerationError => ex
assert_match(/No route matches/, ex.to_s)
end
put :close, :params => { :id => id }
assert_response :not_found, "The changeset #{id} doesn't exist, so can't be closed"
rescue ActionController::UrlGenerationError => ex
assert_match(/No route matches/, ex.to_s)
end
end