]> git.openstreetmap.org Git - rails.git/blobdiff - test/controllers/api/changeset_comments_controller_test.rb
Merge pull request #5692 from tomhughes/ubuntu-latest
[rails.git] / test / controllers / api / changeset_comments_controller_test.rb
index 2d8818986ecec3f8f75b18fd7a51bc619203e6b7..ba4200d3f8d2cfda3f6979b71a8fb74fb5eba0f8 100644 (file)
@@ -9,6 +9,10 @@ module Api
         { :path => "/api/0.6/changeset_comments", :method => :get },
         { :controller => "api/changeset_comments", :action => "index" }
       )
         { :path => "/api/0.6/changeset_comments", :method => :get },
         { :controller => "api/changeset_comments", :action => "index" }
       )
+      assert_routing(
+        { :path => "/api/0.6/changeset_comments.json", :method => :get },
+        { :controller => "api/changeset_comments", :action => "index", :format => "json" }
+      )
       assert_routing(
         { :path => "/api/0.6/changeset/1/comment", :method => :post },
         { :controller => "api/changeset_comments", :action => "create", :id => "1" }
       assert_routing(
         { :path => "/api/0.6/changeset/1/comment", :method => :post },
         { :controller => "api/changeset_comments", :action => "create", :id => "1" }
@@ -65,6 +69,14 @@ module Api
       get api_changeset_comments_path(:user => user1.id)
       assert_response :success
       assert_comments_in_order [comment22, comment21, comment11]
       get api_changeset_comments_path(:user => user1.id)
       assert_response :success
       assert_comments_in_order [comment22, comment21, comment11]
+
+      get api_changeset_comments_path(:from => "2023-03-15T00:00:00Z", :format => "json")
+      assert_response :success
+      js = ActiveSupport::JSON.decode(@response.body)
+      assert_not_nil js
+      assert_equal 2, js["comments"].count
+      assert_equal comment23.id, js["comments"][0]["id"]
+      assert_equal comment22.id, js["comments"][1]["id"]
     end
 
     def test_create_by_unauthorized
     end
 
     def test_create_by_unauthorized