]> git.openstreetmap.org Git - rails.git/commitdiff
Starting the gpx trace testing with additional fixtures
authorShaun McDonald <shaun@shaunmcdonald.me.uk>
Thu, 30 Oct 2008 18:50:45 +0000 (18:50 +0000)
committerShaun McDonald <shaun@shaunmcdonald.me.uk>
Thu, 30 Oct 2008 18:50:45 +0000 (18:50 +0000)
test/fixtures/gpx_file_tags.yml [new file with mode: 0644]
test/fixtures/gpx_files.yml [new file with mode: 0644]
test/fixtures/gpx_points.yml [new file with mode: 0644]
test/functional/api_controller_test.rb
test/test_helper.rb

diff --git a/test/fixtures/gpx_file_tags.yml b/test/fixtures/gpx_file_tags.yml
new file mode 100644 (file)
index 0000000..d914bfb
--- /dev/null
@@ -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 (file)
index 0000000..48c58dc
--- /dev/null
@@ -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 (file)
index 0000000..13ee355
--- /dev/null
@@ -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
+  
index b6bd2bf1dfa606ef3ded71386228244c97748178..8fb8dcc386298031146e3f3f5043c87a95accc39 100644 (file)
@@ -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
index c01c31fca7eac4eb13374c71b6cb519bf42bdad2..f355bf7853cdb3f51d6a4f8d20d955d7198be8fe 100644 (file)
@@ -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
 
   ##