From: Shaun McDonald Date: Tue, 22 Jul 2008 14:06:53 +0000 (+0000) Subject: Now just got one test to sort on the functional tests. All other tests are working... X-Git-Tag: live~7616^2~309 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/3d5ee2675b65030ef233ff95c58a70547c6f3995 Now just got one test to sort on the functional tests. All other tests are working and pass. Plenty more to write though. --- diff --git a/test/fixtures/current_ways.yml b/test/fixtures/current_ways.yml index b129d7f45..9b5b5ab8a 100644 --- a/test/fixtures/current_ways.yml +++ b/test/fixtures/current_ways.yml @@ -3,16 +3,19 @@ visible_way: user_id: 1 timestamp: 2007-01-01 00:00:00 visible: 1 + version: 1 invisible_way: id: 2 user_id: 1 timestamp: 2007-01-01 00:00:00 visible: 0 + version: 1 used_way: id: 3 user_id: 1 timestamp: 2007-01-01 00:00:00 visible: 1 + version: 1 diff --git a/test/fixtures/messages.yml b/test/fixtures/messages.yml index feab6536e..22fab1863 100644 --- a/test/fixtures/messages.yml +++ b/test/fixtures/messages.yml @@ -1,16 +1,16 @@ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html one: - sender: normal_user + from_user_id: 1 title: test message 1 body: some body text sent_on: "2008-05-01 12:34:56" message_read: false - recipient: second_user + to_user_id: 2 two: - sender: second_user + from_user_id: 2 title: test message 2 body: some body test sent_on: "2008-05-02 12:45:23" message_read: true - recipient: normal_user + to_user_id: 1 diff --git a/test/fixtures/user_preferences.yml b/test/fixtures/user_preferences.yml index ab95c357d..59ebd0542 100644 --- a/test/fixtures/user_preferences.yml +++ b/test/fixtures/user_preferences.yml @@ -1,11 +1,11 @@ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html a: - user: normal_user + user_id: 1 k: "key" v: "value" two: - user: normal_user + user_id: 1 k: "some_key" v: "some_value" diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml index 5a788c25c..28e1aca3d 100644 --- a/test/fixtures/users.yml +++ b/test/fixtures/users.yml @@ -1,5 +1,6 @@ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html normal_user: + id: 1 email: test@openstreetmap.org active: 1 pass_crypt: <%= Digest::MD5.hexdigest('test') %> @@ -12,6 +13,7 @@ normal_user: home_zoom: 3 second_user: + id: 2 email: test@example.com active: 1 pass_crypt: <%= Digest::MD5.hexdigest('test') %> @@ -24,6 +26,7 @@ second_user: home_zoom: 12 inactive_user: + id: 3 email: inactive@openstreetmap.org active: 0 pass_crypt: <%= Digest::MD5::hexdigest('test2') %> diff --git a/test/fixtures/way_nodes.yml b/test/fixtures/way_nodes.yml index caeac16b1..c12a248a0 100644 --- a/test/fixtures/way_nodes.yml +++ b/test/fixtures/way_nodes.yml @@ -1,9 +1,15 @@ -t1: +t1a: id: 1 node_id: 3 sequence_id: 1 version: 1 +t1b: + id: 1 + node_id: 4 + sequence_id: 2 + version: 1 + t2: id: 2 node_id: 3 diff --git a/test/functional/api_controller_test.rb b/test/functional/api_controller_test.rb index 05cbe2af0..4c4787ff7 100644 --- a/test/functional/api_controller_test.rb +++ b/test/functional/api_controller_test.rb @@ -23,7 +23,7 @@ class ApiControllerTest < Test::Unit::TestCase def test_map node = current_nodes(:used_node_1) - bbox = "#{node.latitude-0.1},#{node.longitude-0.1},#{node.latitude+0.1},#{node.longitude+0.1}" + bbox = "#{node.lat-0.1},#{node.lon-0.1},#{node.lat+0.1},#{node.lon+0.1}" get :map, :bbox => bbox if $VERBOSE print @response.body diff --git a/test/functional/node_controller_test.rb b/test/functional/node_controller_test.rb index a380eeb20..3f316d012 100644 --- a/test/functional/node_controller_test.rb +++ b/test/functional/node_controller_test.rb @@ -57,7 +57,7 @@ class NodeControllerTest < Test::Unit::TestCase assert_response :unauthorized # now set auth - basic_authorization("test@openstreetmap.org", "test"); + basic_authorization(users(:normal_user).email, "test"); # this should work delete :delete, :id => current_nodes(:visible_node).id diff --git a/test/functional/old_way_controller_test.rb b/test/functional/old_way_controller_test.rb index 374ea7dc2..b4e3c5127 100644 --- a/test/functional/old_way_controller_test.rb +++ b/test/functional/old_way_controller_test.rb @@ -17,11 +17,13 @@ class OldWayControllerTest < Test::Unit::TestCase # Test reading old ways. # ------------------------------------- - def test_history + def test_history_visible # check that a visible way is returned properly get :history, :id => ways(:visible_way).id assert_response :success - + end + + def test_history_invisible # check chat a non-existent way is not returned get :history, :id => 0 assert_response :not_found diff --git a/test/test_helper.rb b/test/test_helper.rb index e954a9495..22cc0e15c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -29,9 +29,10 @@ class Test::Unit::TestCase def self.api_fixtures fixtures :users - fixtures :current_nodes, :nodes + fixtures :current_nodes, :nodes, :current_node_tags set_fixture_class :current_nodes => :Node set_fixture_class :nodes => :OldNode + set_fixture_class :current_node_tags => :NodeTag fixtures :current_ways, :current_way_nodes, :current_way_tags set_fixture_class :current_ways => :Way