Now just got one test to sort on the functional tests. All other tests are working and pass. Plenty more to write though.

This commit is contained in:
Shaun McDonald 2008-07-22 14:06:53 +00:00
parent ebb8e5524e
commit 3d5ee2675b
9 changed files with 27 additions and 12 deletions

View file

@ -3,16 +3,19 @@ visible_way:
user_id: 1 user_id: 1
timestamp: 2007-01-01 00:00:00 timestamp: 2007-01-01 00:00:00
visible: 1 visible: 1
version: 1
invisible_way: invisible_way:
id: 2 id: 2
user_id: 1 user_id: 1
timestamp: 2007-01-01 00:00:00 timestamp: 2007-01-01 00:00:00
visible: 0 visible: 0
version: 1
used_way: used_way:
id: 3 id: 3
user_id: 1 user_id: 1
timestamp: 2007-01-01 00:00:00 timestamp: 2007-01-01 00:00:00
visible: 1 visible: 1
version: 1

View file

@ -1,16 +1,16 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
one: one:
sender: normal_user from_user_id: 1
title: test message 1 title: test message 1
body: some body text body: some body text
sent_on: "2008-05-01 12:34:56" sent_on: "2008-05-01 12:34:56"
message_read: false message_read: false
recipient: second_user to_user_id: 2
two: two:
sender: second_user from_user_id: 2
title: test message 2 title: test message 2
body: some body test body: some body test
sent_on: "2008-05-02 12:45:23" sent_on: "2008-05-02 12:45:23"
message_read: true message_read: true
recipient: normal_user to_user_id: 1

View file

@ -1,11 +1,11 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
a: a:
user: normal_user user_id: 1
k: "key" k: "key"
v: "value" v: "value"
two: two:
user: normal_user user_id: 1
k: "some_key" k: "some_key"
v: "some_value" v: "some_value"

View file

@ -1,5 +1,6 @@
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
normal_user: normal_user:
id: 1
email: test@openstreetmap.org email: test@openstreetmap.org
active: 1 active: 1
pass_crypt: <%= Digest::MD5.hexdigest('test') %> pass_crypt: <%= Digest::MD5.hexdigest('test') %>
@ -12,6 +13,7 @@ normal_user:
home_zoom: 3 home_zoom: 3
second_user: second_user:
id: 2
email: test@example.com email: test@example.com
active: 1 active: 1
pass_crypt: <%= Digest::MD5.hexdigest('test') %> pass_crypt: <%= Digest::MD5.hexdigest('test') %>
@ -24,6 +26,7 @@ second_user:
home_zoom: 12 home_zoom: 12
inactive_user: inactive_user:
id: 3
email: inactive@openstreetmap.org email: inactive@openstreetmap.org
active: 0 active: 0
pass_crypt: <%= Digest::MD5::hexdigest('test2') %> pass_crypt: <%= Digest::MD5::hexdigest('test2') %>

View file

@ -1,9 +1,15 @@
t1: t1a:
id: 1 id: 1
node_id: 3 node_id: 3
sequence_id: 1 sequence_id: 1
version: 1 version: 1
t1b:
id: 1
node_id: 4
sequence_id: 2
version: 1
t2: t2:
id: 2 id: 2
node_id: 3 node_id: 3

View file

@ -23,7 +23,7 @@ class ApiControllerTest < Test::Unit::TestCase
def test_map def test_map
node = current_nodes(:used_node_1) 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 get :map, :bbox => bbox
if $VERBOSE if $VERBOSE
print @response.body print @response.body

View file

@ -57,7 +57,7 @@ class NodeControllerTest < Test::Unit::TestCase
assert_response :unauthorized assert_response :unauthorized
# now set auth # now set auth
basic_authorization("test@openstreetmap.org", "test"); basic_authorization(users(:normal_user).email, "test");
# this should work # this should work
delete :delete, :id => current_nodes(:visible_node).id delete :delete, :id => current_nodes(:visible_node).id

View file

@ -17,11 +17,13 @@ class OldWayControllerTest < Test::Unit::TestCase
# Test reading old ways. # Test reading old ways.
# ------------------------------------- # -------------------------------------
def test_history def test_history_visible
# check that a visible way is returned properly # check that a visible way is returned properly
get :history, :id => ways(:visible_way).id get :history, :id => ways(:visible_way).id
assert_response :success assert_response :success
end
def test_history_invisible
# check chat a non-existent way is not returned # check chat a non-existent way is not returned
get :history, :id => 0 get :history, :id => 0
assert_response :not_found assert_response :not_found

View file

@ -29,9 +29,10 @@ class Test::Unit::TestCase
def self.api_fixtures def self.api_fixtures
fixtures :users fixtures :users
fixtures :current_nodes, :nodes fixtures :current_nodes, :nodes, :current_node_tags
set_fixture_class :current_nodes => :Node set_fixture_class :current_nodes => :Node
set_fixture_class :nodes => :OldNode set_fixture_class :nodes => :OldNode
set_fixture_class :current_node_tags => :NodeTag
fixtures :current_ways, :current_way_nodes, :current_way_tags fixtures :current_ways, :current_way_nodes, :current_way_tags
set_fixture_class :current_ways => :Way set_fixture_class :current_ways => :Way