Skip to content

Commit 0841bfc

Browse files
committed
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.
1 parent 52177a0 commit 0841bfc

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/controllers/api/notes_controller_test.rb

+9-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ def test_create_anonymous_success
105105
assert_difference "Note.count", 1 do
106106
assert_difference "NoteComment.count", 1 do
107107
assert_no_difference "NoteSubscription.count" do
108-
post api_notes_path(:lat => -1.0, :lon => -1.0, :text => "This is a comment", :format => "json")
108+
assert_difference "NoteTag.count", 2 do
109+
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")
110+
end
109111
end
110112
end
111113
end
@@ -116,6 +118,9 @@ def test_create_anonymous_success
116118
assert_equal "Point", js["geometry"]["type"]
117119
assert_equal [-1.0, -1.0], js["geometry"]["coordinates"]
118120
assert_equal "open", js["properties"]["status"]
121+
assert_equal 2, js["properties"]["tags"].count
122+
assert_equal "OSM_TEST", js["properties"]["tags"]["created_by"]
123+
assert_equal "OSM_TEST_SURVEY", js["properties"]["tags"]["source"]
119124
assert_equal 1, js["properties"]["comments"].count
120125
assert_equal "opened", js["properties"]["comments"].last["action"]
121126
assert_equal "This is a comment", js["properties"]["comments"].last["text"]
@@ -131,6 +136,9 @@ def test_create_anonymous_success
131136
assert_equal [-1.0, -1.0], js["geometry"]["coordinates"]
132137
assert_equal id, js["properties"]["id"]
133138
assert_equal "open", js["properties"]["status"]
139+
assert_equal 2, js["properties"]["tags"].count
140+
assert_equal "OSM_TEST", js["properties"]["tags"]["created_by"]
141+
assert_equal "OSM_TEST_SURVEY", js["properties"]["tags"]["source"]
134142
assert_equal 1, js["properties"]["comments"].count
135143
assert_equal "opened", js["properties"]["comments"].last["action"]
136144
assert_equal "This is a comment", js["properties"]["comments"].last["text"]

0 commit comments

Comments
 (0)