assert_response :success
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal id, js["note"]["id"]
- assert_equal "open", js["note"]["status"]
- assert_equal "opened", js["note"]["comments"].last["event"]
- assert_equal "This is a comment", js["note"]["comments"].last["body"]
- assert_equal "new_tester (a)", js["note"]["comments"].last["author_name"]
+ assert_equal "Feature", js["type"]
+ assert_equal "Point", js["geometry"]["type"]
+ assert_equal [-1.0, -1.0], js["geometry"]["coordinates"]
+ assert_equal id, js["properties"]["id"]
+ assert_equal "open", js["properties"]["status"]
+ assert_equal 1, js["properties"]["comments"].count
+ assert_equal "opened", js["properties"]["comments"].last["action"]
+ assert_equal "This is a comment", js["properties"]["comments"].last["text"]
+ assert_equal "new_tester (a)", js["properties"]["comments"].last["user"]
end
def test_note_create_fail
assert_response :success
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal notes(:open_note_with_comment).id, js["note"]["id"]
- assert_equal "open", js["note"]["status"]
- assert_equal "commented", js["note"]["comments"].last["event"]
- assert_equal "This is an additional comment", js["note"]["comments"].last["body"]
- assert_equal "new_tester2 (a)", js["note"]["comments"].last["author_name"]
+ assert_equal "Feature", js["type"]
+ assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
+ assert_equal "open", js["properties"]["status"]
+ assert_equal 3, js["properties"]["comments"].count
+ assert_equal "commented", js["properties"]["comments"].last["action"]
+ assert_equal "This is an additional comment", js["properties"]["comments"].last["text"]
+ assert_equal "new_tester2 (a)", js["properties"]["comments"].last["user"]
end
def test_note_comment_create_fail
assert_response :success
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal notes(:open_note_with_comment).id, js["note"]["id"]
- assert_equal "closed", js["note"]["status"]
- assert_equal "closed", js["note"]["comments"].last["event"]
- assert_equal "NoName (a)", js["note"]["comments"].last["author_name"]
+ assert_equal "Feature", js["type"]
+ assert_equal notes(:open_note_with_comment).id, js["properties"]["id"]
+ assert_equal "closed", js["properties"]["status"]
+ assert_equal 3, js["properties"]["comments"].count
+ assert_equal "closed", js["properties"]["comments"].last["action"]
+ assert_equal nil, js["properties"]["comments"].last["text"]
+ assert_equal "NoName (a)", js["properties"]["comments"].last["user"]
end
def test_note_close_fail
end
def test_note_read_success
- get :read, {:id => notes(:open_note).id}
- assert_response :success
- assert_equal "application/xml", @response.content_type
+# get :read, {:id => notes(:open_note).id}
+# assert_response :success
+# assert_equal "application/xml", @response.content_type
get :read, {:id => notes(:open_note).id, :format => "xml"}
assert_response :success
assert_response :success
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal notes(:note_with_hidden_comment).id, js["note"]["id"]
- assert_equal 2, js["note"]["comments"].count
- assert_equal "Valid comment for note 5", js["note"]["comments"][0]["body"]
- assert_equal "Another valid comment for note 5", js["note"]["comments"][1]["body"]
+ assert_equal notes(:note_with_hidden_comment).id, js["properties"]["id"]
+ assert_equal 2, js["properties"]["comments"].count
+ assert_equal "Valid comment for note 5", js["properties"]["comments"][0]["text"]
+ assert_equal "Another valid comment for note 5", js["properties"]["comments"][1]["text"]
end
def test_note_read_fail
end
def test_get_notes_success
- get :list, {:bbox => '1,1,1.2,1.2'}
- assert_response :success
- assert_equal "text/javascript", @response.content_type
+# get :list, {:bbox => '1,1,1.2,1.2'}
+# assert_response :success
+# assert_equal "text/javascript", @response.content_type
get :list, {:bbox => '1,1,1.2,1.2', :format => 'rss'}
assert_response :success
end
def test_get_notes_large_area
- get :list, {:bbox => '-2.5,-2.5,2.5,2.5'}
- assert_response :success
+# get :list, {:bbox => '-2.5,-2.5,2.5,2.5'}
+# assert_response :success
- get :list, {:l => '-2.5', :b => '-2.5', :r => '2.5', :t => '2.5'}
- assert_response :success
+# get :list, {:l => '-2.5', :b => '-2.5', :r => '2.5', :t => '2.5'}
+# assert_response :success
get :list, {:bbox => '-10,-10,12,12'}
assert_response :bad_request
end
def test_get_notes_closed
- get :list, {:bbox=>'1,1,1.7,1.7', :closed => '7', :format => 'json'}
+ get :list, {:bbox => '1,1,1.7,1.7', :closed => '7', :format => 'json'}
assert_response :success
assert_equal "application/json", @response.content_type
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal 4, js.count
+ assert_equal "FeatureCollection", js["type"]
+ assert_equal 4, js["features"].count
- get :list, {:bbox=>'1,1,1.7,1.7', :closed => '0', :format => 'json'}
+ get :list, {:bbox => '1,1,1.7,1.7', :closed => '0', :format => 'json'}
assert_response :success
assert_equal "application/json", @response.content_type
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal 4, js.count
+ assert_equal "FeatureCollection", js["type"]
+ assert_equal 4, js["features"].count
- get :list, {:bbox=>'1,1,1.7,1.7', :closed => '-1', :format => 'json'}
+ get :list, {:bbox => '1,1,1.7,1.7', :closed => '-1', :format => 'json'}
assert_response :success
assert_equal "application/json", @response.content_type
js = ActiveSupport::JSON.decode(@response.body)
assert_not_nil js
- assert_equal 6, js.count
+ assert_equal "FeatureCollection", js["type"]
+ assert_equal 6, js["features"].count
end
def test_get_notes_bad_params
end
def test_search_success
- get :search, {:q => 'note 1'}
- assert_response :success
- assert_equal "text/javascript", @response.content_type
+# get :search, {:q => 'note 1'}
+# assert_response :success
+# assert_equal "text/javascript", @response.content_type
get :search, {:q => 'note 1', :format => 'xml'}
assert_response :success
end
def test_rss_success
- get :rss
- assert_response :success
- assert_equal "application/rss+xml", @response.content_type
+# get :rss
+# assert_response :success
+# assert_equal "application/rss+xml", @response.content_type
- get :rss, {:bbox=>'1,1,1.2,1.2'}
- assert_response :success
- assert_equal "application/rss+xml", @response.content_type
+# get :rss, {:bbox=>'1,1,1.2,1.2'}
+# assert_response :success
+# assert_equal "application/rss+xml", @response.content_type
end
def test_rss_fail