X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/91f3339b6a5290b5fbbf58f57ef4f623ab7a8c56..95abc14b305f03de27352a252a451d1e0b200a4d:/test/controllers/notes_controller_test.rb?ds=sidebyside diff --git a/test/controllers/notes_controller_test.rb b/test/controllers/notes_controller_test.rb index c08117f14..3ee283f4a 100644 --- a/test/controllers/notes_controller_test.rb +++ b/test/controllers/notes_controller_test.rb @@ -215,6 +215,13 @@ class NotesControllerTest < ActionController::TestCase end end assert_response :bad_request + + assert_no_difference "Note.count" do + assert_no_difference "NoteComment.count" do + post :create, :lat => -1.0, :lon => -1.0, :text => "x\u0000y" + end + end + assert_response :bad_request end def test_comment_success @@ -376,6 +383,11 @@ class NotesControllerTest < ActionController::TestCase post :comment, :id => closed_note_with_comment.id, :text => "This is an additional comment" end assert_response :conflict + + assert_no_difference "NoteComment.count" do + post :comment, :id => open_note_with_comment.id, :text => "x\u0000y" + end + assert_response :bad_request end def test_close_success @@ -589,7 +601,7 @@ class NotesControllerTest < ActionController::TestCase def test_destroy_success open_note_with_comment = create(:note_with_comments) user = create(:user) - moderator_user = create(:moderator_user, :status => "active") + moderator_user = create(:moderator_user) delete :destroy, :id => open_note_with_comment.id, :text => "This is a hide comment", :format => "json" assert_response :unauthorized @@ -619,7 +631,7 @@ class NotesControllerTest < ActionController::TestCase def test_destroy_fail user = create(:user) - moderator_user = create(:moderator_user, :status => "active") + moderator_user = create(:moderator_user) delete :destroy, :id => 12345, :format => "json" assert_response :unauthorized @@ -950,7 +962,7 @@ class NotesControllerTest < ActionController::TestCase def test_mine_success first_user = create(:user) second_user = create(:user) - moderator_user = create(:moderator_user, :status => "active", :terms_seen => true) + moderator_user = create(:moderator_user) create(:note) do |note| create(:note_comment, :note => note, :author => first_user)