X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/96671cf0c0f014e61ac1eb3f11460376e067f0c2..9929c1b585bd0e0b088cc785af06720d46f2dcce:/test/controllers/api/nodes_controller_test.rb diff --git a/test/controllers/api/nodes_controller_test.rb b/test/controllers/api/nodes_controller_test.rb index 04120dace..523498216 100644 --- a/test/controllers/api/nodes_controller_test.rb +++ b/test/controllers/api/nodes_controller_test.rb @@ -31,7 +31,7 @@ module Api ) assert_routing( { :path => "/api/0.6/node/1", :method => :delete }, - { :controller => "api/nodes", :action => "delete", :id => "1" } + { :controller => "api/nodes", :action => "destroy", :id => "1" } ) assert_recognizes( @@ -193,18 +193,24 @@ module Api assert_match(/ v: is too long \(maximum is 255 characters\) /, @response.body) end - def test_show - # check that a visible node is returned properly - get api_node_path(create(:node)) - assert_response :success + def test_show_not_found + get api_node_path(0) + assert_response :not_found + end - # check that an deleted node is not returned + def test_show_deleted get api_node_path(create(:node, :deleted)) assert_response :gone + end - # check chat a non-existent node is not returned - get api_node_path(0) - assert_response :not_found + def test_show + node = create(:node, :timestamp => "2021-02-03T00:00:00Z") + + get api_node_path(node) + + assert_response :success + assert_not_nil @response.header["Last-Modified"] + assert_equal "2021-02-03T00:00:00Z", Time.parse(@response.header["Last-Modified"]).utc.xmlschema end # Ensure the lat/lon is formatted as a decimal e.g. not 4.0e-05 @@ -218,7 +224,7 @@ module Api # this tests deletion restrictions - basic deletion is tested in the unit # tests for node! - def test_delete + def test_destroy private_user = create(:user, :data_public => false) private_user_changeset = create(:changeset, :user => private_user) private_user_closed_changeset = create(:changeset, :closed, :user => private_user)