Move api element show and full tests
This commit is contained in:
parent
18f65b78eb
commit
9ef7f3a2e7
2 changed files with 29 additions and 29 deletions
|
@ -17,14 +17,6 @@ module Api
|
||||||
{ :path => "/api/0.6/relations", :method => :post },
|
{ :path => "/api/0.6/relations", :method => :post },
|
||||||
{ :controller => "api/relations", :action => "create" }
|
{ :controller => "api/relations", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
|
||||||
{ :path => "/api/0.6/relation/1/full", :method => :get },
|
|
||||||
{ :controller => "api/relations", :action => "full", :id => "1" }
|
|
||||||
)
|
|
||||||
assert_routing(
|
|
||||||
{ :path => "/api/0.6/relation/1/full.json", :method => :get },
|
|
||||||
{ :controller => "api/relations", :action => "full", :id => "1", :format => "json" }
|
|
||||||
)
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1", :method => :get },
|
{ :path => "/api/0.6/relation/1", :method => :get },
|
||||||
{ :controller => "api/relations", :action => "show", :id => "1" }
|
{ :controller => "api/relations", :action => "show", :id => "1" }
|
||||||
|
@ -33,6 +25,14 @@ module Api
|
||||||
{ :path => "/api/0.6/relation/1.json", :method => :get },
|
{ :path => "/api/0.6/relation/1.json", :method => :get },
|
||||||
{ :controller => "api/relations", :action => "show", :id => "1", :format => "json" }
|
{ :controller => "api/relations", :action => "show", :id => "1", :format => "json" }
|
||||||
)
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1/full", :method => :get },
|
||||||
|
{ :controller => "api/relations", :action => "full", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/relation/1/full.json", :method => :get },
|
||||||
|
{ :controller => "api/relations", :action => "full", :id => "1", :format => "json" }
|
||||||
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/relation/1", :method => :put },
|
{ :path => "/api/0.6/relation/1", :method => :put },
|
||||||
{ :controller => "api/relations", :action => "update", :id => "1" }
|
{ :controller => "api/relations", :action => "update", :id => "1" }
|
||||||
|
@ -136,6 +136,19 @@ module Api
|
||||||
assert_response :not_found
|
assert_response :not_found
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_full
|
||||||
|
# check the "full" mode
|
||||||
|
get relation_full_path(:id => 999999)
|
||||||
|
assert_response :not_found
|
||||||
|
|
||||||
|
get relation_full_path(:id => create(:relation, :deleted).id)
|
||||||
|
assert_response :gone
|
||||||
|
|
||||||
|
get relation_full_path(:id => create(:relation).id)
|
||||||
|
assert_response :success
|
||||||
|
# FIXME: check whether this contains the stuff we want!
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# check that all relations containing a particular node, and no extra
|
# check that all relations containing a particular node, and no extra
|
||||||
# relations, are returned from the relations_for_node call.
|
# relations, are returned from the relations_for_node call.
|
||||||
|
@ -201,19 +214,6 @@ module Api
|
||||||
[relation_with_relation, second_relation])
|
[relation_with_relation, second_relation])
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_full
|
|
||||||
# check the "full" mode
|
|
||||||
get relation_full_path(:id => 999999)
|
|
||||||
assert_response :not_found
|
|
||||||
|
|
||||||
get relation_full_path(:id => create(:relation, :deleted).id)
|
|
||||||
assert_response :gone
|
|
||||||
|
|
||||||
get relation_full_path(:id => create(:relation).id)
|
|
||||||
assert_response :success
|
|
||||||
# FIXME: check whether this contains the stuff we want!
|
|
||||||
end
|
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Test simple relation creation.
|
# Test simple relation creation.
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
|
@ -17,14 +17,6 @@ module Api
|
||||||
{ :path => "/api/0.6/ways", :method => :post },
|
{ :path => "/api/0.6/ways", :method => :post },
|
||||||
{ :controller => "api/ways", :action => "create" }
|
{ :controller => "api/ways", :action => "create" }
|
||||||
)
|
)
|
||||||
assert_routing(
|
|
||||||
{ :path => "/api/0.6/way/1/full", :method => :get },
|
|
||||||
{ :controller => "api/ways", :action => "full", :id => "1" }
|
|
||||||
)
|
|
||||||
assert_routing(
|
|
||||||
{ :path => "/api/0.6/way/1/full.json", :method => :get },
|
|
||||||
{ :controller => "api/ways", :action => "full", :id => "1", :format => "json" }
|
|
||||||
)
|
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1", :method => :get },
|
{ :path => "/api/0.6/way/1", :method => :get },
|
||||||
{ :controller => "api/ways", :action => "show", :id => "1" }
|
{ :controller => "api/ways", :action => "show", :id => "1" }
|
||||||
|
@ -33,6 +25,14 @@ module Api
|
||||||
{ :path => "/api/0.6/way/1.json", :method => :get },
|
{ :path => "/api/0.6/way/1.json", :method => :get },
|
||||||
{ :controller => "api/ways", :action => "show", :id => "1", :format => "json" }
|
{ :controller => "api/ways", :action => "show", :id => "1", :format => "json" }
|
||||||
)
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1/full", :method => :get },
|
||||||
|
{ :controller => "api/ways", :action => "full", :id => "1" }
|
||||||
|
)
|
||||||
|
assert_routing(
|
||||||
|
{ :path => "/api/0.6/way/1/full.json", :method => :get },
|
||||||
|
{ :controller => "api/ways", :action => "full", :id => "1", :format => "json" }
|
||||||
|
)
|
||||||
assert_routing(
|
assert_routing(
|
||||||
{ :path => "/api/0.6/way/1", :method => :put },
|
{ :path => "/api/0.6/way/1", :method => :put },
|
||||||
{ :controller => "api/ways", :action => "update", :id => "1" }
|
{ :controller => "api/ways", :action => "update", :id => "1" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue