]> git.openstreetmap.org Git - rails.git/commitdiff
Add show_redactions checks to api old element index tests
authorAnton Khorev <tony29@yandex.ru>
Sun, 9 Feb 2025 15:04:18 +0000 (18:04 +0300)
committerAnton Khorev <tony29@yandex.ru>
Mon, 10 Feb 2025 23:08:28 +0000 (02:08 +0300)
test/controllers/api/old_nodes_controller_test.rb
test/controllers/api/old_relations_controller_test.rb
test/controllers/api/old_ways_controller_test.rb

index 7afa8c99701e2488ac7607aee5997430fc1a9ed3..6ffb8c7ca3731d3f27e69a65718c927d9b12fdd3 100644 (file)
@@ -61,6 +61,12 @@ module Api
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm node[id='#{node.id}'][version='1']", 0,
                  "redacted node #{node.id} version 1 shouldn't be present in the history."
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm node[id='#{node.id}'][version='1']", 0,
                  "redacted node #{node.id} version 1 shouldn't be present in the history."
+
+      get api_node_versions_path(node, :show_redactions => "true")
+
+      assert_response :success, "Redaction shouldn't have stopped history working."
+      assert_dom "osm node[id='#{node.id}'][version='1']", 0,
+                 "redacted node #{node.id} version 1 shouldn't be present in the history when passing flag."
     end
 
     def test_index_redacted_normal_user
     end
 
     def test_index_redacted_normal_user
@@ -72,6 +78,12 @@ module Api
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm node[id='#{node.id}'][version='1']", 0,
                  "redacted node #{node.id} version 1 shouldn't be present in the history, even when logged in."
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm node[id='#{node.id}'][version='1']", 0,
                  "redacted node #{node.id} version 1 shouldn't be present in the history, even when logged in."
+
+      get api_node_versions_path(node, :show_redactions => "true"), :headers => bearer_authorization_header
+
+      assert_response :success, "Redaction shouldn't have stopped history working."
+      assert_dom "osm node[id='#{node.id}'][version='1']", 0,
+                 "redacted node #{node.id} version 1 shouldn't be present in the history, even when logged in and passing flag."
     end
 
     def test_show
     end
 
     def test_show
index b5600ad379fc93b25e02853e944a5084c417b55c..1e3953590f85d7104825c5ae2313fab4830241de 100644 (file)
@@ -64,6 +64,12 @@ module Api
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm relation[id='#{relation.id}'][version='1']", 0,
                  "redacted relation #{relation.id} version 1 shouldn't be present in the history."
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm relation[id='#{relation.id}'][version='1']", 0,
                  "redacted relation #{relation.id} version 1 shouldn't be present in the history."
+
+      get api_relation_versions_path(relation, :show_redactions => "true")
+
+      assert_response :success, "Redaction shouldn't have stopped history working."
+      assert_dom "osm relation[id='#{relation.id}'][version='1']", 0,
+                 "redacted relation #{relation.id} version 1 shouldn't be present in the history when passing flag."
     end
 
     def test_index_redacted_normal_user
     end
 
     def test_index_redacted_normal_user
@@ -75,6 +81,12 @@ module Api
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm relation[id='#{relation.id}'][version='1']", 0,
                  "redacted relation #{relation.id} version 1 shouldn't be present in the history, even when logged in."
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm relation[id='#{relation.id}'][version='1']", 0,
                  "redacted relation #{relation.id} version 1 shouldn't be present in the history, even when logged in."
+
+      get api_relation_versions_path(relation, :show_redactions => "true"), :headers => bearer_authorization_header
+
+      assert_response :success, "Redaction shouldn't have stopped history working."
+      assert_dom "osm relation[id='#{relation.id}'][version='1']", 0,
+                 "redacted relation #{relation.id} version 1 shouldn't be present in the history, even when logged in and passing flag."
     end
 
     def test_show
     end
 
     def test_show
index 53dc41fbe49bda3457d7c3206d35ea6e136ffc53..84c2cef3fd58eaa828b13cdb8d51df4550ab0e2f 100644 (file)
@@ -71,6 +71,12 @@ module Api
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm way[id='#{way.id}'][version='1']", 0,
                  "redacted way #{way.id} version 1 shouldn't be present in the history."
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm way[id='#{way.id}'][version='1']", 0,
                  "redacted way #{way.id} version 1 shouldn't be present in the history."
+
+      get api_way_versions_path(way, :show_redactions => "true")
+
+      assert_response :success, "Redaction shouldn't have stopped history working."
+      assert_dom "osm way[id='#{way.id}'][version='1']", 0,
+                 "redacted way #{way.id} version 1 shouldn't be present in the history when passing flag."
     end
 
     def test_index_redacted_normal_user
     end
 
     def test_index_redacted_normal_user
@@ -82,6 +88,12 @@ module Api
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm way[id='#{way.id}'][version='1']", 0,
                  "redacted node #{way.id} version 1 shouldn't be present in the history, even when logged in."
       assert_response :success, "Redaction shouldn't have stopped history working."
       assert_dom "osm way[id='#{way.id}'][version='1']", 0,
                  "redacted node #{way.id} version 1 shouldn't be present in the history, even when logged in."
+
+      get api_way_versions_path(way, :show_redactions => "true"), :headers => bearer_authorization_header
+
+      assert_response :success, "Redaction shouldn't have stopped history working."
+      assert_dom "osm way[id='#{way.id}'][version='1']", 0,
+                 "redacted node #{way.id} version 1 shouldn't be present in the history, even when logged in and passing flag."
     end
 
     def test_show
     end
 
     def test_show