Test Last-Modified header of api show element responses
This commit is contained in:
parent
cee07eee09
commit
e837727d95
3 changed files with 18 additions and 4 deletions
|
@ -204,8 +204,13 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show
|
def test_show
|
||||||
get api_node_path(create(:node))
|
node = create(:node, :timestamp => "2021-02-03T00:00:00Z")
|
||||||
|
|
||||||
|
get api_node_path(node)
|
||||||
|
|
||||||
assert_response :success
|
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
|
end
|
||||||
|
|
||||||
# Ensure the lat/lon is formatted as a decimal e.g. not 4.0e-05
|
# Ensure the lat/lon is formatted as a decimal e.g. not 4.0e-05
|
||||||
|
|
|
@ -133,13 +133,15 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show
|
def test_show
|
||||||
relation = create(:relation)
|
relation = create(:relation, :timestamp => "2021-02-03T00:00:00Z")
|
||||||
node = create(:node)
|
node = create(:node, :timestamp => "2021-04-05T00:00:00Z")
|
||||||
create(:relation_member, :relation => relation, :member => node)
|
create(:relation_member, :relation => relation, :member => node)
|
||||||
|
|
||||||
get api_relation_path(relation)
|
get api_relation_path(relation)
|
||||||
|
|
||||||
assert_response :success
|
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
|
||||||
assert_dom "node", :count => 0
|
assert_dom "node", :count => 0
|
||||||
assert_dom "relation", :count => 1 do
|
assert_dom "relation", :count => 1 do
|
||||||
assert_dom "> @id", :text => relation.id.to_s
|
assert_dom "> @id", :text => relation.id.to_s
|
||||||
|
|
|
@ -107,8 +107,15 @@ module Api
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_show
|
def test_show
|
||||||
get api_way_path(create(:way))
|
way = create(:way, :timestamp => "2021-02-03T00:00:00Z")
|
||||||
|
node = create(:node, :timestamp => "2021-04-05T00:00:00Z")
|
||||||
|
create(:way_node, :way => way, :node => node)
|
||||||
|
|
||||||
|
get api_way_path(way)
|
||||||
|
|
||||||
assert_response :success
|
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
|
end
|
||||||
|
|
||||||
def test_show_json
|
def test_show_json
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue