- minor testing fixes.
--- /dev/null
+class OldRelationController < ApplicationController
+ require 'xml/libxml'
+
+ session :off
+ after_filter :compress_output
+
+ def history
+ begin
+ relation = Relation.find(params[:id])
+ doc = OSM::API.new.get_xml_doc
+
+ relation.old_relations.each do |old_relation|
+ doc.root << old_relation.to_xml_node
+ end
+
+ render :text => doc.to_s, :content_type => "text/xml"
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => :not_found
+ rescue
+ render :nothing => true, :status => :internal_server_error
+ end
+ end
+end
--- /dev/null
+class OldRelationMemberController < ApplicationController
+
+end
--- /dev/null
+class OldRelationTagController < ApplicationController
+
+end
checknode = Node.find(nodeid)
assert_not_nil checknode, "uploaded node not found in data base after upload"
# compare values
- assert_in_delta lat, checknode.latitude, 1E-8, "saved node does not match requested latitude"
- assert_in_delta lon, checknode.longitude, 1E-8, "saved node does not match requested longitude"
+ assert_in_delta lat * 10000000, checknode.latitude, 1, "saved node does not match requested latitude"
+ assert_in_delta lon * 10000000, checknode.longitude, 1, "saved node does not match requested longitude"
assert_equal users(:normal_user).id, checknode.user_id, "saved node does not belong to user that created it"
assert_equal true, checknode.visible, "saved node is not visible"
end
--- /dev/null
+require File.dirname(__FILE__) + '/../test_helper'
+require 'old_relation_controller'
+
+# Re-raise errors caught by the controller.
+#class OldRelationController; def rescue_action(e) raise e end; end
+
+class OldRelationControllerTest < Test::Unit::TestCase
+ api_fixtures
+
+ def setup
+ @controller = OldRelationController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ # -------------------------------------
+ # Test reading old relations.
+ # -------------------------------------
+
+ def test_history
+ # check that a visible relations is returned properly
+ get :history, :id => relations(:visible_relation).id
+ assert_response :success
+
+ # check chat a non-existent relations is not returned
+ get :history, :id => 0
+ assert_response :not_found
+
+ end
+
+end
--- /dev/null
+require File.dirname(__FILE__) + '/../test_helper'
+require 'old_way_controller'
+
+# Re-raise errors caught by the controller.
+class OldWayController; def rescue_action(e) raise e end; end
+
+class OldWayControllerTest < Test::Unit::TestCase
+ api_fixtures
+
+ def setup
+ @controller = OldWayController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ # -------------------------------------
+ # Test reading old ways.
+ # -------------------------------------
+
+ def test_history
+ # check that a visible way is returned properly
+ get :history, :id => ways(:visible_way).id
+ assert_response :success
+
+ # check chat a non-existent way is not returned
+ get :history, :id => 0
+ assert_response :not_found
+
+ end
+
+end
print @response.body
end
-
# check the "relations for relation" mode
get :relations_for_relation, :id => current_relations(:used_relation).id
assert_response :success
set_fixture_class :ways => :OldWay
set_fixture_class :way_nodes => :OldWayNode
set_fixture_class :way_tags => :OldWayTag
+
+ fixtures :current_relations, :current_relation_members, :current_relation_tags
+ set_fixture_class :current_relations => :Relation
+ set_fixture_class :current_relation_members => :RelationMember
+ set_fixture_class :current_relation_tags => :RelationTag
+
+ fixtures :relations, :relation_members, :relation_tags
+ set_fixture_class :relations => :OldRelation
+ set_fixture_class :relation_members => :OldRelationMember
+ set_fixture_class :relation_tags => :OldRelationTag
end
# Add more helper methods to be used by all tests here...