Adding an extra test to make sure that the correct response is returned when an invalid changeset action is uploaded.

This commit is contained in:
Shaun McDonald 2008-11-03 18:54:19 +00:00
parent e932a69bd7
commit 183ffc7864
3 changed files with 33 additions and 2 deletions

View file

@ -156,7 +156,7 @@ class DiffReader
else
# no other actions to choose from, so it must be the users fault!
raise "Unknown action #{action_name}, choices are create, modify, delete."
raise OSM::APIChangesetActionInvalid.new(action_name)
end
end

View file

@ -66,6 +66,19 @@ module OSM
"#{@allowed} is allowed.", :status => :conflict }
end
end
# Raised when a diff upload has an unknown action. You can only have create,
# modify, or delete
class APIChangesetActionInvalid < APIError
def initialize(provided)
@provided = provided
end
def render_opts
{ :text => "Unknown action #{@provided}, choices are create, modify, delete.",
:status => :bad_request }
end
end
# Raised when bad XML is encountered which stops things parsing as
# they should.