From 9705105681afef0482763d830096c52b430fe943 Mon Sep 17 00:00:00 2001 From: Shaun McDonald Date: Thu, 30 Oct 2008 18:50:45 +0000 Subject: [PATCH] Starting the gpx trace testing with additional fixtures --- test/fixtures/gpx_file_tags.yml | 4 ++++ test/fixtures/gpx_files.yml | 12 ++++++++++++ test/fixtures/gpx_points.yml | 9 +++++++++ test/functional/api_controller_test.rb | 17 +++++++++++++++++ test/test_helper.rb | 5 +++++ 5 files changed, 47 insertions(+) create mode 100644 test/fixtures/gpx_file_tags.yml create mode 100644 test/fixtures/gpx_files.yml create mode 100644 test/fixtures/gpx_points.yml diff --git a/test/fixtures/gpx_file_tags.yml b/test/fixtures/gpx_file_tags.yml new file mode 100644 index 000000000..d914bfb84 --- /dev/null +++ b/test/fixtures/gpx_file_tags.yml @@ -0,0 +1,4 @@ +first_trace_1: + gpx_id: 1 + tag: London + id: 1 diff --git a/test/fixtures/gpx_files.yml b/test/fixtures/gpx_files.yml new file mode 100644 index 000000000..48c58dca9 --- /dev/null +++ b/test/fixtures/gpx_files.yml @@ -0,0 +1,12 @@ +first_trace_file: + id: 1 + user_id: 1 + visible: 1 + name: Fist Trace.gpx + size: + latitude: 1 + longitude: 1 + timestamp: "2008-10-29 10:10:10" + public: 1 + description: This is a trace + inserted: 1 diff --git a/test/fixtures/gpx_points.yml b/test/fixtures/gpx_points.yml new file mode 100644 index 000000000..13ee3552a --- /dev/null +++ b/test/fixtures/gpx_points.yml @@ -0,0 +1,9 @@ +first_trace_1: + altitude: 134 + trackid: 1 + latitude: 1 + longitude: 1 + gpx_id: 1 + timestamp: "2008-10-01 10:10:10" + tile: 1 + diff --git a/test/functional/api_controller_test.rb b/test/functional/api_controller_test.rb index b6bd2bf1d..8fb8dcc38 100644 --- a/test/functional/api_controller_test.rb +++ b/test/functional/api_controller_test.rb @@ -51,6 +51,23 @@ class ApiControllerTest < ActionController::TestCase end end + def test_tracepoints + node = gpx_files(:first_trace_file) + minlon = node.longitude-0.1 + minlat = node.latitude-0.1 + maxlon = node.longitude+0.1 + maxlat = node.latitude+0.1 + bbox = "#{minlon},#{minlat},#{maxlon},#{maxlat}" + get :trackpoints, :bbox => bbox + #print @response.body + assert_response :success + assert_select "gpx[version=1.0][creator=OpenStreetMap.org][xmlns=http://www.topografix.com/GPX/1/0/]:root", :count => 1 do + assert_select "trk" do + assert_select "trkseg" + end + end + end + def test_map_without_bbox ["trackpoints", "map"].each do |tq| get tq diff --git a/test/test_helper.rb b/test/test_helper.rb index c01c31fca..f355bf785 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -57,6 +57,11 @@ class Test::Unit::TestCase set_fixture_class :relations => OldRelation set_fixture_class :relation_members => OldRelationMember set_fixture_class :relation_tags => OldRelationTag + + fixtures :gpx_files, :gpx_points, :gpx_file_tags + set_fixture_class :gpx_files => Trace + set_fixture_class :gpx_points => Tracepoint + set_fixture_class :gpx_file_tags => Tracetag end ## -- 2.43.2