File obs-server-2.10-0129-Adopt-test-suites-to-rexml-changes.patch of Package obs-server

From 0ae6206a288e4f336eebba656a27d715ef8256f1 Mon Sep 17 00:00:00 2001
From: Henne Vogelsang <hvogel@opensuse.org>
Date: Wed, 9 Jun 2021 13:42:37 +0200
Subject: [PATCH] Adopt test suites to rexml changes

Co-authored-by: Stephan Kulow <coolo@suse.de>
---
 .../test/functional/binary_release_test.rb    | 30 +++++++++----------
 .../functional/channel_maintenance_test.rb    | 14 ++++-----
 .../test/functional/issue_controller_test.rb  | 24 +++++++--------
 .../test/functional/search_controller_test.rb |  4 +--
 .../test/functional/source_controller_test.rb |  2 +-
 5 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/src/api/test/functional/binary_release_test.rb b/src/api/test/functional/binary_release_test.rb
index 7183f0f8a9..80343e13e2 100644
--- a/src/api/test/functional/binary_release_test.rb
+++ b/src/api/test/functional/binary_release_test.rb
@@ -65,63 +65,63 @@ class BinaryReleaseTest < ActionDispatch::IntegrationTest
     assert_no_xml_tag tag: 'binary'
 
     # by repo
-    get '/search/released/binary', params: { match: "repository/[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo']" }
+    get '/search/released/binary', params: { match: "repository[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo']" }
     assert_response :success
     assert_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586' }
     assert_xml_tag tag: 'obsolete'
 
     # without obsolete rpms
-    get '/search/released/binary', params: { match: "repository/[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo'] and obsolete[not(@time)]" }
+    get '/search/released/binary', params: { match: "repository[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo'] and obsolete[not(@time)]" }
     assert_response :success
     assert_no_xml_tag tag: 'obsolete'
 
     # without modified rpms
-    get '/search/released/binary', params: { match: "repository/[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo'] and modify[not(@time)]" }
+    get '/search/released/binary', params: { match: "repository[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo'] and modify[not(@time)]" }
     assert_response :success
     assert_no_xml_tag tag: 'modify'
 
     # by product
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed' and (@arch = 'i586' or not(@arch))]" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed' and (@arch = 'i586' or not(@arch))]" }
     assert_response :success
     assert_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586', medium: 'DVD' }
     assert_xml_tag tag: 'updatefor', attributes: { project: 'BaseDistro', product: 'fixed' }
     assert_xml_tag tag: 'product', attributes: { name: 'fixed', version: '1.2' }
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed' and @medium = 'DVD']" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed' and @medium = 'DVD']" }
     assert_response :success
     assert_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586', medium: 'DVD' }
     # by version
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed' and @version = '1.2']" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed' and @version = '1.2']" }
     assert_response :success
     assert_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586', medium: 'DVD' }
     # not matching version
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed' and @version = '2.99']" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed' and @version = '2.99']" }
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '0' }
     assert_no_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586', medium: 'DVD' }
     # baseversion
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed' and @baseversion = '1.2' and @patchlevel='0']" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed' and @baseversion = '1.2' and @patchlevel='0']" }
     assert_response :success
     # not matching baseversion
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed' and @baseversion = '1.2' and @patchlevel='43']" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed' and @baseversion = '1.2' and @patchlevel='43']" }
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '0' }
 
     # by update for product
-    get '/search/released/binary', params: { match: "updatefor/[@project = 'BaseDistro' and @product = 'fixed' and @arch = 'i586']" }
+    get '/search/released/binary', params: { match: "updatefor[@project = 'BaseDistro' and @product = 'fixed' and @arch = 'i586']" }
     assert_response :success
     assert_no_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3' }
-    get '/search/released/binary', params: { match: "updatefor/[@project = 'BaseDistro' and @product = 'fixed' and @arch = 'x86_64']" }
+    get '/search/released/binary', params: { match: "updatefor[@project = 'BaseDistro' and @product = 'fixed' and @arch = 'x86_64']" }
     assert_response :success
     assert_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586' }
     assert_xml_tag tag: 'updatefor', attributes: { project: 'BaseDistro', product: 'fixed' }
 
     # by version
-    get '/search/released/binary', params: { match: "updatefor/[@project = 'BaseDistro' and @product = 'fixed' and @baseversion = '1.2' and @patchlevel='0']" }
+    get '/search/released/binary', params: { match: "updatefor[@project = 'BaseDistro' and @product = 'fixed' and @baseversion = '1.2' and @patchlevel='0']" }
     assert_response :success
-    get '/search/released/binary', params: { match: "updatefor/[@project = 'BaseDistro' and @product = 'fixed' and @version = '1.2']" }
+    get '/search/released/binary', params: { match: "updatefor[@project = 'BaseDistro' and @product = 'fixed' and @version = '1.2']" }
     assert_response :success
     # not matching
-    get '/search/released/binary', params: { match: "updatefor/[@project = 'BaseDistro' and @product = 'fixed' and @version = '1.3']" }
+    get '/search/released/binary', params: { match: "updatefor[@project = 'BaseDistro' and @product = 'fixed' and @version = '1.3']" }
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '0' }
 
@@ -137,7 +137,7 @@ class BinaryReleaseTest < ActionDispatch::IntegrationTest
     assert_xml_tag tag: 'collection', attributes: { matches: '0' }
 
     # by update for product OR product itself
-    get '/search/released/binary', params: { match: "product/[@project = 'BaseDistro' and @name = 'fixed'] or updatefor/[@project = 'BaseDistro' and @product = 'fixed']" }
+    get '/search/released/binary', params: { match: "product[@project = 'BaseDistro' and @name = 'fixed'] or updatefor[@project = 'BaseDistro' and @product = 'fixed']" }
     assert_response :success
     assert_xml_tag tag: 'binary', attributes: { project: 'BaseDistro3', repository: 'BaseDistro3_repo', name: 'package', version: '1.0', release: '1', arch: 'i586' }
     assert_xml_tag tag: 'updatefor', attributes: { project: 'BaseDistro', product: 'fixed' }
diff --git a/src/api/test/functional/channel_maintenance_test.rb b/src/api/test/functional/channel_maintenance_test.rb
index 872f562338..ae7f6adc64 100644
--- a/src/api/test/functional/channel_maintenance_test.rb
+++ b/src/api/test/functional/channel_maintenance_test.rb
@@ -506,11 +506,11 @@ class ChannelMaintenanceTests < ActionDispatch::IntegrationTest
     assert_xml_tag tag: 'collection', children: { count: 2 }
     assert_xml_tag tag: 'repository', attributes: { project: 'home:tom:branches:OBS_Maintained:pack2', name: 'BaseDistro2.0_LinkedUpdateProject' }
     assert_xml_tag tag: 'repository', attributes: { project: incident_project, name: 'BaseDistro2.0_LinkedUpdateProject' }
-    get "/search/repository/id?match=targetproduct/[@name='simple'+and+@version='13.1']+and+@project='#{incident_project}'"
+    get "/search/repository/id?match=targetproduct[@name='simple'+and+@version='13.1']+and+@project='#{incident_project}'"
     assert_response :success
     assert_xml_tag tag: 'collection', children: { count: 1 }
     assert_xml_tag tag: 'repository', attributes: { project: incident_project, name: 'BaseDistro2.0_LinkedUpdateProject' }
-    get "/search/repository/id?match=targetproduct/[@name='simple'+and+@baseversion='1'+and+@patchlevel='1']"
+    get "/search/repository/id?match=targetproduct[@name='simple'+and+@baseversion='1'+and+@patchlevel='1']"
     assert_response :success # empty, just to check for crashes
 
     login_king
@@ -738,13 +738,13 @@ class ChannelMaintenanceTests < ActionDispatch::IntegrationTest
     assert_xml_tag parent: { tag: 'channel', attributes: { project: 'Channel', package: 'BaseDistro3' } },
                    tag: 'binary', attributes: { project: 'BaseDistro3', package: 'pack2', name: 'package' }
     # search by given product
-    get '/search/channel/binary?match=updatefor/[@project="BaseDistro"+and+@product="fixed"]'
+    get '/search/channel/binary?match=updatefor[@project="BaseDistro"+and+@product="fixed"]'
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '2' }
-    get '/search/channel/binary?match=updatefor/[@project="BaseDistro"+and+@product="fixed"]+and+not(target/disabled)'
+    get '/search/channel/binary?match=updatefor[@project="BaseDistro"+and+@product="fixed"]+and+not(target/disabled)'
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '0' }
-    get '/search/channel/binary?match=updatefor/[@project="BaseDistro"+and+@product="fixed"]+and+boolean(target/disabled)'
+    get '/search/channel/binary?match=updatefor[@project="BaseDistro"+and+@product="fixed"]+and+boolean(target/disabled)'
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '2' }
     get '/search/channel/binary?match=not(target/disabled)'
@@ -757,7 +757,7 @@ class ChannelMaintenanceTests < ActionDispatch::IntegrationTest
 
     # event handling
     UpdateNotificationEvents.new.perform
-    get '/search/released/binary', params: { match: "repository/[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo']" }
+    get '/search/released/binary', params: { match: "repository[@project = 'BaseDistro3' and @name = 'BaseDistro3_repo']" }
     assert_response :success
     assert_xml_tag parent: { tag: 'binary', attributes: { name: 'package_newweaktags', version: '1.0', release: '1', arch: 'x86_64' } },
                    tag: 'publish', attributes: { package: 'pack2' }
@@ -776,7 +776,7 @@ class ChannelMaintenanceTests < ActionDispatch::IntegrationTest
     assert_xml_tag parent: { tag: 'binary', attributes:            { name: 'dropped', project: 'BaseDistro3', repository: 'BaseDistro3_repo', arch: 'i586' } },
                    tag: 'operation', content: 'added'
     # entire channel content
-    get '/search/released/binary', params: { match: "repository/[@project = 'BaseDistro3Channel']" }
+    get '/search/released/binary', params: { match: "repository[@project = 'BaseDistro3Channel']" }
     assert_response :success
     assert_xml_tag parent: { tag: 'binary', attributes:            { name: 'package', project: 'BaseDistro3Channel', repository: 'channel_repo', arch: 'i586' } },
                    tag: 'operation', content: 'added'
diff --git a/src/api/test/functional/issue_controller_test.rb b/src/api/test/functional/issue_controller_test.rb
index 653ba8d1b5..fb240f3e56 100644
--- a/src/api/test/functional/issue_controller_test.rb
+++ b/src/api/test/functional/issue_controller_test.rb
@@ -61,7 +61,7 @@ class IssueControllerTest < ActionDispatch::IntegrationTest
     assert_response 401
     get '/search/package/id', params: { match: 'issue/@tracker="bnc"' }
     assert_response 401
-    get '/search/package/id', params: { match: 'issue/[@name="123456" and @tracker="bnc"]' }
+    get '/search/package/id', params: { match: 'issue[@name="123456" and @tracker="bnc"]' }
     assert_response 401
     get '/search/package/id', params: { match: 'issue/owner/@login="fred"' }
     assert_response 401
@@ -72,15 +72,15 @@ class IssueControllerTest < ActionDispatch::IntegrationTest
     login_Iggy
 
     # running patchinfo search as done by webui
-    get '/search/package/id', params: { match: '[issue/[@state="CLOSED" and owner/@login="fred"] and kind="patchinfo"]' }
+    get '/search/package/id', params: { match: '[issue[@state="CLOSED" and owner/@login="fred"] and kind="patchinfo"]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
-    get '/search/package/id', params: { match: '[issue/[@state="OPEN" and owner/@login="king"] and kind="patchinfo"]' }
+    get '/search/package/id', params: { match: '[issue[@state="OPEN" and owner/@login="king"] and kind="patchinfo"]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
 
     # validate that state and login are from same issue. NOT matching:
-    get '/search/package/id', params: { match: '[issue/[@state="CLOSED" and owner/@login="king"] and kind="patchinfo"]' }
+    get '/search/package/id', params: { match: '[issue[@state="CLOSED" and owner/@login="king"] and kind="patchinfo"]' }
     assert_response :success
     assert_no_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
 
@@ -94,20 +94,20 @@ class IssueControllerTest < ActionDispatch::IntegrationTest
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
 
     # running patchinfo search as done by webui
-    get '/search/package/id', params: { match: '[kind="patchinfo" and issue/[@state="CLOSED" and owner/@login="fred"]]' }
+    get '/search/package/id', params: { match: '[kind="patchinfo" and issue[@state="CLOSED" and owner/@login="fred"]]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
 
     # test with not matching kind to verify that it does not match
-    get '/search/package/id', params: { match: '[issue/[@state="CLOSED" and owner/@login="fred"] and kind="aggregate"]' }
+    get '/search/package/id', params: { match: '[issue[@state="CLOSED" and owner/@login="fred"] and kind="aggregate"]' }
     assert_response :success
     assert_no_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
 
     # search via bug issue id
-    get '/search/package/id', params: { match: '[issue/[@name="123456" and @tracker="bnc"]]' }
+    get '/search/package/id', params: { match: '[issue[@name="123456" and @tracker="bnc"]]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
-    get '/search/package/id', params: { match: '[issue/[@tracker="bnc" and @name="123456"]]' } # SQL keeps working
+    get '/search/package/id', params: { match: '[issue[@tracker="bnc" and @name="123456"]]' } # SQL keeps working
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package', attributes: { project: 'BaseDistro', name: 'patchinfo' }
   end
@@ -211,23 +211,23 @@ Aha bnc#123456\n
     assert_response :success
     assert_xml_tag parent: { tag: 'issue', attributes: { change: 'added' } }, tag: 'name', content: '123456'
 
-    get '/search/package/id', params: { match: '[issue/[@name="123456" and @tracker="bnc" and @change="added"]]' }
+    get '/search/package/id', params: { match: '[issue[@name="123456" and @tracker="bnc" and @change="added"]]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package',
                    attributes: { project: 'home:Iggy:branches:BaseDistro', name: 'pack_new' }
 
-    get '/search/package/id', params: { match: '[issue/[@name="123456" and @tracker="bnc" and (@change="added" or @change="changed")]]' }
+    get '/search/package/id', params: { match: '[issue[@name="123456" and @tracker="bnc" and (@change="added" or @change="changed")]]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package',
                    attributes: { project: 'home:Iggy:branches:BaseDistro', name: 'pack_new' }
 
-    get '/search/package/id', params: { match: '[issue/[@name="123456" and @tracker="bnc" and @change="kept"]]' }
+    get '/search/package/id', params: { match: '[issue[@name="123456" and @tracker="bnc" and @change="kept"]]' }
     assert_response :success
     assert_no_xml_tag parent: { tag: 'collection' }, tag: 'package',
                       attributes: { project: 'home:Iggy:branches:BaseDistro', name: 'pack_new' }
 
     # search for attribute issues
-    get '/search/package/id', params: { match: '[attribute_issue/[@name="987" and @tracker="bnc"]]' }
+    get '/search/package/id', params: { match: '[attribute_issue[@name="987" and @tracker="bnc"]]' }
     assert_response :success
     assert_xml_tag parent: { tag: 'collection' }, tag: 'package',
                    attributes: { project: 'home:Iggy:branches:BaseDistro', name: 'pack_new' }
diff --git a/src/api/test/functional/search_controller_test.rb b/src/api/test/functional/search_controller_test.rb
index 55e42d787d..6a084fc6a7 100644
--- a/src/api/test/functional/search_controller_test.rb
+++ b/src/api/test/functional/search_controller_test.rb
@@ -340,7 +340,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
     assert_xml_tag tag: 'repository', attributes: { project: 'home:Iggy', name: '10.2' }
     assert repos.count, 1
 
-    get "/search/repository/id?match=path/[@project='BaseDistro'+and+@repository='BaseDistro_repo']"
+    get "/search/repository/id?match=path[@project='BaseDistro'+and+@repository='BaseDistro_repo']"
     assert_response :success
     assert_xml_tag tag: 'collection'
     assert_xml_tag tag: 'repository', attributes: { project: 'home:Iggy', name: '10.2' }
@@ -350,7 +350,7 @@ class SearchControllerTest < ActionDispatch::IntegrationTest
   def test_osc_search_devel_package_after_request_accept
     login_Iggy
 
-    get '/search/package', params: { match: "([devel/[@project='Devel:BaseDistro:Update' and @package='pack2']])" }
+    get '/search/package', params: { match: "([devel[@project='Devel:BaseDistro:Update' and @package='pack2']])" }
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: 1 }
     assert_xml_tag tag: 'package', attributes: { project: 'BaseDistro:Update', name: 'pack2' }
diff --git a/src/api/test/functional/source_controller_test.rb b/src/api/test/functional/source_controller_test.rb
index 4f8bff9f1d..90581e6cdb 100644
--- a/src/api/test/functional/source_controller_test.rb
+++ b/src/api/test/functional/source_controller_test.rb
@@ -3408,7 +3408,7 @@ class SourceControllerTest < ActionDispatch::IntegrationTest
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '1' }
     # no product, but no crash either. More checks are in channel_maintenance test case
-    get '/search/channel/binary?match=updatefor/[@project="not_defined"+and+@product="missing"]'
+    get '/search/channel/binary?match=updatefor[@project="not_defined"+and+@product="missing"]'
     assert_response :success
     assert_xml_tag tag: 'collection', attributes: { matches: '0' }
     # simple short form test
-- 
2.31.1