From 0841bfcd8d86b7abb0f3c19acfc8a522a2686a5f Mon Sep 17 00:00:00 2001 From: Nenad Vujicic Date: Wed, 13 Nov 2024 01:12:06 +0100 Subject: [PATCH] Test note/tag output created at POST/HTML level Added testing of note XML, JSON, GPX, RSS and feed outputs (with tags) when note (and tags) are created by sending POST/HTTP request. --- test/controllers/api/notes_controller_test.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/controllers/api/notes_controller_test.rb b/test/controllers/api/notes_controller_test.rb index bc55acaf77..d7d5c8f938 100644 --- a/test/controllers/api/notes_controller_test.rb +++ b/test/controllers/api/notes_controller_test.rb @@ -105,7 +105,9 @@ def test_create_anonymous_success assert_difference "Note.count", 1 do assert_difference "NoteComment.count", 1 do assert_no_difference "NoteSubscription.count" do - post api_notes_path(:lat => -1.0, :lon => -1.0, :text => "This is a comment", :format => "json") + assert_difference "NoteTag.count", 2 do + post api_notes_path(:lat => -1.0, :lon => -1.0, :tags => "created_by:OSM_TEST,source:OSM_TEST_SURVEY", :text => "This is a comment", :format => "json") + end end end end @@ -116,6 +118,9 @@ def test_create_anonymous_success assert_equal "Point", js["geometry"]["type"] assert_equal [-1.0, -1.0], js["geometry"]["coordinates"] assert_equal "open", js["properties"]["status"] + assert_equal 2, js["properties"]["tags"].count + assert_equal "OSM_TEST", js["properties"]["tags"]["created_by"] + assert_equal "OSM_TEST_SURVEY", js["properties"]["tags"]["source"] 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"] @@ -131,6 +136,9 @@ def test_create_anonymous_success assert_equal [-1.0, -1.0], js["geometry"]["coordinates"] assert_equal id, js["properties"]["id"] assert_equal "open", js["properties"]["status"] + assert_equal 2, js["properties"]["tags"].count + assert_equal "OSM_TEST", js["properties"]["tags"]["created_by"] + assert_equal "OSM_TEST_SURVEY", js["properties"]["tags"]["source"] 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"]