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:
parent
e932a69bd7
commit
183ffc7864
3 changed files with 33 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
13
lib/osm.rb
13
lib/osm.rb
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue