]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/notes_controller_test.rb
Don't show hidden notes to non-moderators in the user notes list
[rails.git] / test / controllers / notes_controller_test.rb
index 8dc0866da8816c9918dca2035503175d1230998f..5cdcbb31df6dca84a0e6a1607074c6d61e9cb0f5 100644 (file)
@@ -510,6 +510,10 @@ class NotesControllerTest < ActionController::TestCase
     assert_equal "application/gpx+xml", @response.content_type
     assert_select "gpx", :count => 1 do
       assert_select "wpt[lat='#{notes(:open_note).lat}'][lon='#{notes(:open_note).lon}']", :count => 1 do
+        assert_select "time", :count => 1
+        assert_select "name", "Note: #{notes(:open_note).id}"
+        assert_select "desc", :count => 1
+        assert_select "link[href='http://www.openstreetmap.org/note/#{notes(:open_note).id}']", :count => 1
         assert_select "extensions", :count => 1 do
           assert_select "id", notes(:open_note).id
           assert_select "url", note_url(notes(:open_note), :format => "gpx")
@@ -868,9 +872,24 @@ class NotesControllerTest < ActionController::TestCase
   def test_mine_success
     get :mine, :display_name => "test"
     assert_response :success
+    assert_select "table.note_list tr", :count => 2
 
     get :mine, :display_name => "pulibc_test2"
     assert_response :success
+    assert_select "table.note_list tr", :count => 3
+
+    get :mine, :display_name => "non-existent"
+    assert_response :not_found
+
+    session[:user] = users(:moderator_user).id
+
+    get :mine, :display_name => "test"
+    assert_response :success
+    assert_select "table.note_list tr", :count => 2
+
+    get :mine, :display_name => "pulibc_test2"
+    assert_response :success
+    assert_select "table.note_list tr", :count => 4
 
     get :mine, :display_name => "non-existent"
     assert_response :not_found