- {latest => -1, v1 => v1.version}.each do |way, v|
- amf_content "getway_old", "/1", [way.id, v]
+ { latest => '',
+ v1 => v1.timestamp.strftime("%d %b %Y, %H:%M:%S")
+ }.each do |way, t|
+ amf_content "getway_old", "/1", [way.id, t]
+ post :amf_read
+ assert_response :success
+ amf_parse_response
+ returned_way = amf_result("/1")
+ assert_equal 0, returned_way[0]
+ assert_equal way.id, returned_way[2]
+ # API returns the *latest* version, even for old ways...
+ assert_equal latest.version, returned_way[5]
+ end
+ end
+
+ ##
+ # test that the server doesn't fall over when rubbish is passed
+ # into the method args.
+ def test_getway_old_invalid
+ way_id = current_ways(:way_with_versions).id
+ { "foo" => "bar",
+ way_id => "not a date",
+ way_id => "2009-03-25 00:00:00", # <- wrong format
+ way_id => "0 Jan 2009 00:00:00", # <- invalid date
+ -1 => "1 Jan 2009 00:00:00" # <- invalid ID
+ }.each do |id, t|
+ amf_content "getway_old", "/1", [id, t]