From dc9edf9683bf0eac16f02dd2bf39cfd765a9b2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Wed, 12 Aug 2026 09:38:29 +0200 Subject: [PATCH 1/5] Update the csv and the rails-html-sanitizer gems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As reported by depfu, these two gems had candidates for security updates. Let's use them as they are safe and they bring security updates (even if we are not particularly affected by them). Closes #1535 Closes #1520 Signed-off-by: Miquel Sabaté Solà --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index edbd65da1..0b520d02d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -80,7 +80,7 @@ GEM bigdecimal rexml crass (1.0.7) - csv (3.3.5) + csv (3.3.6) date (3.5.1) deep_merge (1.2.2) diff-lcs (1.6.2) @@ -220,8 +220,8 @@ GEM activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) - rails-html-sanitizer (1.6.2) - loofah (~> 2.21) + rails-html-sanitizer (1.7.1) + loofah (~> 2.25, >= 2.25.2) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (8.1.3.1) actionpack (= 8.1.3.1) From bed8cce432df09db21f57d1488f677e0a6452ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Wed, 12 Aug 2026 09:42:45 +0200 Subject: [PATCH 2/5] Update puma from 7.x to 8.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As raised by Fergal in https://github.com/SUSE/rmt/pull/1477, this is not a trivial update, but testing this locally it seems fine. We can always revert this commit if things go south. Moreover, the puma version has been pinned to use the 8.x releases, so to ensure that no future major changes are suggested by tools like depfu without human consideration. Signed-off-by: Miquel Sabaté Solà --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 488cc1117..9c203f8ab 100644 --- a/Gemfile +++ b/Gemfile @@ -19,7 +19,7 @@ gem 'bootsnap', require: false gem 'ostruct' gem 'csv' -gem 'puma' +gem 'puma', '~> 8' gem 'mysql2' gem 'sqlite3' diff --git a/Gemfile.lock b/Gemfile.lock index 0b520d02d..97ec3c141 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -205,7 +205,7 @@ GEM date stringio public_suffix (7.0.5) - puma (7.2.1) + puma (8.0.2) nio4r (~> 2.0) racc (1.8.1) rack (3.2.5) @@ -459,7 +459,7 @@ DEPENDENCIES nokogiri ostruct public_suffix - puma + puma (~> 8) rackup railties (~> 8.1.3.1) repomd_parser From 6f41a00279650e3b79c40c1e5e796aebc3241992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Wed, 12 Aug 2026 11:28:55 +0200 Subject: [PATCH 3/5] Pin down mysql2 and nokogiri MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The mysql2 gem is fundamental to the proper behavior of RMT, so it's a good idea to pin it down. Note that sqlite3 has not been pinned down as it's still considered an experimental feature for RMT. Also pin down nokogiri, as it's prone to difficult upgrades. Signed-off-by: Miquel Sabaté Solà --- Gemfile | 4 ++-- Gemfile.lock | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 9c203f8ab..ad2057990 100644 --- a/Gemfile +++ b/Gemfile @@ -20,10 +20,10 @@ gem 'ostruct' gem 'csv' gem 'puma', '~> 8' -gem 'mysql2' +gem 'mysql2', '~> 0.5' gem 'sqlite3' -gem 'nokogiri' +gem 'nokogiri', '~> 1' gem 'thor' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder diff --git a/Gemfile.lock b/Gemfile.lock index 97ec3c141..7bcfe7493 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -455,8 +455,8 @@ DEPENDENCIES memory_profiler minitest mixlib-shellout - mysql2 - nokogiri + mysql2 (~> 0.5) + nokogiri (~> 1) ostruct public_suffix puma (~> 8) From a2061f78221cbf3ce4f9bd370482d030b98dfb4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Wed, 12 Aug 2026 11:30:52 +0200 Subject: [PATCH 4/5] General upgrade of minor gems MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A bunch of minor gems have been upgraded to their latest patch-level/minor candidates. No regressions have been discovered because of this. Signed-off-by: Miquel Sabaté Solà --- Gemfile.lock | 191 ++++++++++++++++++++++++++------------------------- 1 file changed, 97 insertions(+), 94 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 7bcfe7493..e61910057 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -44,18 +44,18 @@ GEM securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) - addressable (2.8.9) + addressable (2.9.0) public_suffix (>= 2.0.2, < 8.0) - anyway_config (2.7.2) + anyway_config (2.8.1) ruby-next-core (~> 1.0) ast (2.4.3) awesome_print (1.9.2) base32 (0.3.4) base64 (0.3.0) - benchmark (0.4.0) - bigdecimal (4.0.1) - bootsnap (1.19.0) - msgpack (~> 1.2) + benchmark (0.5.0) + bigdecimal (4.1.2) + bootsnap (1.25.0) + msgpack (~> 1.5) builder (3.3.0) byebug (13.0.0) reline (>= 0.6.0) @@ -63,45 +63,44 @@ GEM ffi (~> 1.0) case_transform (0.2) activesupport - chef-utils (19.1.164) + chef-utils (19.3.15) concurrent-ruby coderay (1.1.3) - concurrent-ruby (1.3.7) + concurrent-ruby (1.3.8) config (5.6.1) deep_merge (~> 1.2, >= 1.2.1) ostruct - connection_pool (2.5.5) - coveralls_reborn (0.29.0) - simplecov (~> 0.22.0) - term-ansicolor (~> 1.7) - thor (~> 1.2) - tins (~> 1.32) + connection_pool (3.0.2) + coveralls_reborn (1.0.0) + simplecov (>= 1.0) + term-ansicolor (>= 1.11) + thor (>= 1.5) + tins (>= 1.54) crack (1.0.1) bigdecimal rexml crass (1.0.7) csv (3.3.6) - date (3.5.1) deep_merge (1.2.2) diff-lcs (1.6.2) - docile (1.4.1) drb (2.2.3) dry-initializer (3.2.0) - erb (6.0.1) + erb (6.0.7) erubi (1.13.1) - ethon (0.15.0) + ethon (0.18.0) ffi (>= 1.15.0) - factory_bot (6.5.6) + logger + factory_bot (6.6.0) activesupport (>= 6.1.0) factory_bot_rails (6.5.1) factory_bot (~> 6.5) railties (>= 6.1.0) - fakefs (3.2.0) + fakefs (3.2.1) fast_gettext (4.1.1) prime racc ffaker (2.25.0) - ffi (1.17.3-x86_64-linux-gnu) + ffi (1.17.4-x86_64-linux-gnu) fiddle (1.1.8) formatador (1.2.3) reline @@ -109,18 +108,18 @@ GEM fuubar (2.5.1) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) - gettext (3.5.1) + gettext (3.5.2) erubi locale (>= 2.0.5) prime racc text (>= 1.3.0) - gettext_i18n_rails (2.1.0) + gettext_i18n_rails (2.2.0) fast_gettext (>= 0.9.0) gettext_test_log (0.2.1) - globalid (1.3.0) + globalid (1.4.0) activesupport (>= 6.1) - guard (2.20.1) + guard (2.20.2) formatador (>= 0.2.4) listen (>= 2.7, < 4.0) logger (~> 1.6) @@ -136,29 +135,30 @@ GEM guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) hashdiff (1.2.1) - i18n (1.14.8) + i18n (1.15.2) concurrent-ruby (~> 1.0) - io-console (0.8.2) - irb (1.17.0) + io-console (0.9.2) + irb (1.18.0) pp (>= 0.6.0) prism (>= 1.3.0) rdoc (>= 4.0.0) reline (>= 0.4.2) - json (2.19.9) + json (2.21.2) jsonapi-renderer (0.2.2) jwt (2.10.3) base64 - kramdown (2.5.1) - rexml (>= 3.3.9) + kramdown (2.5.2) + rexml (>= 3.4.4) kramdown-parser-gfm (1.1.0) kramdown (~> 2.0) - language_server-protocol (3.17.0.5) + language_server-protocol (3.17.0.6) lint_roller (1.1.0) listen (3.10.0) logger rb-fsevent (~> 0.10, >= 0.10.3) rb-inotify (~> 0.9, >= 0.9.10) - locale (2.1.4) + locale (2.1.5) + fiddle logger (1.7.0) loofah (2.25.2) crass (~> 1.0.2) @@ -166,14 +166,14 @@ GEM lumberjack (1.4.2) memory_profiler (1.1.0) method_source (1.1.0) - minitest (6.0.2) + minitest (6.0.6) drb (~> 2.0) prism (~> 1.5) mixlib-shellout (3.4.10) chef-utils mize (0.6.1) msgpack (1.8.4) - mustache (1.1.1) + mustache (1.1.2) mysql2 (0.5.7) bigdecimal nenv (0.3.0) @@ -184,11 +184,11 @@ GEM nenv (~> 0.1) shellany (~> 0.0) ostruct (0.6.3) - parallel (1.27.0) - parser (3.3.10.2) + parallel (1.28.0) + parser (3.3.12.0) ast (~> 2.4.1) racc - pp (0.6.3) + pp (0.6.4) prettyprint prettyprint (0.2.0) prime (0.1.4) @@ -201,15 +201,12 @@ GEM coderay (~> 1.1) method_source (~> 1.0) reline (>= 0.6.0) - psych (5.3.1) - date - stringio public_suffix (7.0.5) puma (8.0.2) nio4r (~> 2.0) racc (1.8.1) - rack (3.2.5) - rack-session (2.1.1) + rack (3.2.6) + rack-session (2.1.2) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) @@ -233,22 +230,27 @@ GEM tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) - rake (13.3.1) + rake (13.4.2) rb-fsevent (0.11.2) rb-inotify (0.11.1) ffi (~> 1.0) - rdoc (7.2.0) + rbs (4.1.3) + logger + prism (>= 1.6.0) + tsort + rdoc (8.0.0) erb - psych (>= 4.0.0) + prism (>= 1.6.0) + rbs (>= 4.0.0) tsort readline (0.0.4) reline - redis-client (0.28.0) + redis-client (0.30.1) connection_pool - regexp_parser (2.11.3) - reline (0.6.3) + regexp_parser (2.12.0) + reline (0.7.0) io-console (~> 0.5) - repomd_parser (1.2.0) + repomd_parser (1.3.0) bzip2-ffi (~> 1.1.1) nokogiri (~> 1.8) ruby-xz (~> 1.0, >= 1.0.3) @@ -274,17 +276,17 @@ GEM rspec-its (2.0.0) rspec-core (>= 3.13.0) rspec-expectations (>= 3.13.0) - rspec-mocks (3.13.7) + rspec-mocks (3.13.8) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) - rspec-rails (8.0.2) + rspec-rails (8.0.4) actionpack (>= 7.2) activesupport (>= 7.2) railties (>= 7.2) - rspec-core (~> 3.13) - rspec-expectations (~> 3.13) - rspec-mocks (~> 3.13) - rspec-support (~> 3.13) + rspec-core (>= 3.13.0, < 5.0.0) + rspec-expectations (>= 3.13.0, < 5.0.0) + rspec-mocks (>= 3.13.0, < 5.0.0) + rspec-support (>= 3.13.0, < 5.0.0) rspec-support (3.13.7) rubocop (1.75.3) json (~> 2.3) @@ -306,25 +308,29 @@ GEM rubocop-factory_bot (2.28.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) - rubocop-performance (1.19.1) - rubocop (>= 1.7.0, < 2.0) - rubocop-ast (>= 0.4.0) - rubocop-rails (2.34.3) + rubocop-performance (1.26.0) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rails (2.36.0) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.44.0, < 2.0) - rubocop-rake (0.6.0) - rubocop (~> 1.0) + rubocop-rake (0.7.1) + lint_roller (~> 1.1) + rubocop (>= 1.72.1) rubocop-rspec (3.0.5) rubocop (~> 1.61) rubocop-rspec_rails (2.30.0) rubocop (~> 1.61) rubocop-rspec (~> 3, >= 3.0.1) - rubocop-thread_safety (0.5.1) - rubocop (>= 0.90.0) - ruby-next-core (1.1.2) + rubocop-thread_safety (0.7.3) + lint_roller (~> 1.1) + rubocop (~> 1.72, >= 1.72.1) + rubocop-ast (>= 1.44.0, < 2.0) + ruby-next-core (1.2.1) ruby-progressbar (1.13.0) ruby-xz (1.0.3) ruby_parser (3.22.0) @@ -343,31 +349,25 @@ GEM securerandom (0.4.1) sexp_processor (4.17.5) shellany (0.0.1) - shoulda-matchers (7.0.1) - activesupport (>= 7.1) - sidekiq (7.3.10) - base64 - connection_pool (>= 2.3.0, < 3) - logger - rack (>= 2.2.4, < 3.3) - redis-client (>= 0.23.0, < 1) - simplecov (0.22.0) - docile (~> 1.1) - simplecov-html (~> 0.11) - simplecov_json_formatter (~> 0.1) - simplecov-html (0.13.2) - simplecov_json_formatter (0.1.4) + shoulda-matchers (8.0.1) + activesupport (>= 7.2) + sidekiq (8.1.6) + connection_pool (>= 3.0.0) + json (>= 2.16.0) + logger (>= 1.7.0) + rack (>= 3.2.0) + redis-client (>= 0.29.0) + simplecov (1.1.0) singleton (0.3.0) - spring (4.4.2) + spring (4.7.0) spring-commands-rspec (1.0.4) spring (>= 0.9.1) spring-watcher-listen (2.1.0) listen (>= 2.7, < 4.0) spring (>= 4) - sqlite3 (2.9.5-x86_64-linux-gnu) - stringio (3.2.0) - strong_migrations (2.5.1) - activerecord (>= 7.1) + sqlite3 (2.9.6-x86_64-linux-gnu) + strong_migrations (2.8.0) + activerecord (>= 7.2) sync (0.5.0) term-ansicolor (1.11.3) tins (~> 1) @@ -376,18 +376,21 @@ GEM text (1.3.1) thor (1.5.0) timecop (0.9.11) - timeout (0.4.4) - tins (1.51.1) + timeout (0.6.1) + tins (1.56.0) bigdecimal + irb mize (~> 0.6) readline sync tsort (0.2.0) - typhoeus (1.5.0) - ethon (>= 0.9.0, < 0.16.0) + typhoeus (1.6.0) + ethon (>= 0.18.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unicode-display_width (2.6.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.2.0) uri (1.1.1) useragent (0.16.11) vcr (6.4.0) @@ -395,12 +398,12 @@ GEM activesupport (>= 3) railties (>= 3) yard (~> 0.9.20) - webmock (3.26.1) + webmock (3.26.2) addressable (>= 2.8.0) crack (>= 0.3.2) hashdiff (>= 0.4.0, < 2.0.0) webrick (1.9.2) - yabeda (0.14.0) + yabeda (0.16.0) anyway_config (>= 1.0, < 3) concurrent-ruby dry-initializer @@ -412,13 +415,13 @@ GEM json puma yabeda (~> 0.5) - yabeda-rails (0.10.0) + yabeda-rails (0.11.0) activesupport anyway_config (>= 1.3, < 3) railties yabeda (~> 0.8) - yard (0.9.44) - zeitwerk (2.7.4) + yard (0.9.45) + zeitwerk (2.8.3) zstd-ruby (1.5.7.1) PLATFORMS From 888bcd020d685022d15717ba893a4fe0ad97dfcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miquel=20Sabat=C3=A9=20Sol=C3=A0?= Date: Wed, 12 Aug 2026 11:33:02 +0200 Subject: [PATCH 5/5] Fix style issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While upgrading rubocop in commit a2061f78221c ("General upgrade of minor gems"), some minor style issues were detected. This was mainly about the new Rails/ResponseParsedBody rule, but there was also an issue on strong parameters. Signed-off-by: Miquel Sabaté Solà --- app/controllers/services_controller.rb | 2 +- .../subscriptions/systems_controller_spec.rb | 4 +- .../v3/systems/products_controller_spec.rb | 42 +++++++++---------- .../billing_check_controller_spec.rb | 8 ++-- .../v3/systems/activations_controller_spec.rb | 10 ++--- .../subscriptions/systems_controller_spec.rb | 16 +++---- .../v3/systems/products_controller_spec.rb | 18 ++++---- .../v3/systems/systems_controller_spec.rb | 2 +- .../v4/systems/products_controller_spec.rb | 14 +++---- .../scc_suma_api_controller_spec.rb | 2 +- .../v3/systems/activations_controller_spec.rb | 6 +-- .../v3/systems/products_controller_spec.rb | 2 +- 12 files changed, 63 insertions(+), 63 deletions(-) diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index fd5a3550f..262a57c77 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -23,7 +23,7 @@ class ServicesController < ApplicationController ZYPPER_SERVICE_TTL = 86400 def show - service = Service.find(params[:id]) + service = Service.find(params.expect(:id)) repos = service.repositories.exclude_installer_updates builder = Builder::XmlMarkup.new diff --git a/engines/instance_verification/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb b/engines/instance_verification/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb index 46d09ba60..22645adb3 100644 --- a/engines/instance_verification/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb +++ b/engines/instance_verification/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb @@ -7,7 +7,7 @@ context 'using RMT generated credentials' do it 'saves instance data' do post '/connect/subscriptions/systems', params: { hostname: 'test', instance_data: instance_data } - data = JSON.parse(response.body) + data = response.parsed_body system = System.find_by(login: data['login']) expect(system.instance_data).to eq(instance_data) expect(system.login).to start_with('SCC_') @@ -19,7 +19,7 @@ it 'saves instance data' do allow_any_instance_of(InstanceVerification::Providers::Example).to receive(:instance_identifier).and_return('i-12345') post '/connect/subscriptions/systems', params: { hostname: 'test', instance_data: instance_data } - data = JSON.parse(response.body) + data = response.parsed_body system = System.find_by(login: data['login']) expect(system.instance_data).to eq(instance_data) expect(system.login).to start_with('i-') diff --git a/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb b/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb index 9fa3743b3..bdb0ae3fa 100644 --- a/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb +++ b/engines/instance_verification/spec/requests/api/connect/v3/systems/products_controller_spec.rb @@ -120,7 +120,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') end end @@ -143,7 +143,7 @@ end it 'renders an error with exception details' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') end end @@ -195,7 +195,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') end end @@ -212,7 +212,7 @@ end it 'renders an error with exception details' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') end end @@ -231,7 +231,7 @@ end it 'renders an error with exception details' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Instance verification failed: Custom plugin error') end end @@ -313,7 +313,7 @@ let(:product_classes) { [base_product.product_class] } it 'de-registers system from SCC and reports an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Instance verification failed: The product is not available for this instance') end end @@ -396,7 +396,7 @@ let(:product_classes) { [base_product.product_class] } it 'de-registers system from SCC and reports an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') expect(response).to have_http_status(422) end @@ -520,7 +520,7 @@ context 'when regcode is provided' do it 'returns service JSON' do # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end end @@ -561,7 +561,7 @@ it 'returns service JSON' do # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end @@ -615,8 +615,8 @@ it 'allow the extension' do # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) - data = JSON.parse(response.body) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) + data = response.parsed_body expect(data['name']).to include('Live_Patch') expect(data['product']['product_class']).to eq('SLE-LP') end @@ -671,7 +671,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') end end @@ -689,7 +689,7 @@ end it 'renders an error with exception details' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Unexpected instance verification error has occurred') end end @@ -777,7 +777,7 @@ context 'when no regcode is provided' do it 'activates the product' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['product']['free']).to eq(false) expect(data['id']).to eq(product.id) expect(controller).not_to receive(:update_pubcloud_reg_code) @@ -843,7 +843,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Migration target not allowed on this instance type') end end @@ -872,7 +872,7 @@ end it "doesn't render an error" do - data = JSON.parse(response.body) + data = response.parsed_body expect(data).not_to have_key('error') end end @@ -899,7 +899,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Migration target not allowed on this instance type') end end @@ -923,7 +923,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data).to have_key('error') end end @@ -951,7 +951,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Migration target not allowed on this instance type') end end @@ -971,7 +971,7 @@ end it 'renders an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Migration target not allowed on this instance type') end end @@ -996,7 +996,7 @@ end it "doesn't render an error" do - data = JSON.parse(response.body) + data = response.parsed_body expect(data).not_to have_key('error') end end diff --git a/engines/instance_verification/spec/requests/instance_verification/billing_check_controller_spec.rb b/engines/instance_verification/spec/requests/instance_verification/billing_check_controller_spec.rb index 59d57e33a..9e56f86c7 100644 --- a/engines/instance_verification/spec/requests/instance_verification/billing_check_controller_spec.rb +++ b/engines/instance_verification/spec/requests/instance_verification/billing_check_controller_spec.rb @@ -15,7 +15,7 @@ module InstanceVerification it 'returns PAYG' do get '/api/instance/check', params: { metadata: billing_info.to_s, identifier: 'SLES' } - expect(JSON.parse(response.body)['flavor']).to eq('PAYG') + expect(response.parsed_body['flavor']).to eq('PAYG') end end @@ -29,7 +29,7 @@ module InstanceVerification it 'returns PAYG' do get '/api/instance/check', params: { metadata: billing_info.to_s, identifier: 'SLES_SAP' } - expect(JSON.parse(response.body)['flavor']).to eq('PAYG') + expect(response.parsed_body['flavor']).to eq('PAYG') end end @@ -43,7 +43,7 @@ module InstanceVerification it 'returns BYOS' do get '/api/instance/check', params: { metadata: billing_info.to_s, identifier: 'SLES' } - expect(JSON.parse(response.body)['flavor']).to eq('BYOS') + expect(response.parsed_body['flavor']).to eq('BYOS') end end @@ -60,7 +60,7 @@ module InstanceVerification expect(InstanceVerification::Providers::Example).to receive(:new).at_least(:once).and_return(plugin_double) allow(plugin_double).to receive(:parse_instance_data).and_raise(InstanceVerification::Exception, 'Malformed instance data') get '/api/instance/check', params: { metadata: billing_info.to_s, identifier: 'SLES' } - expect(JSON.parse(response.body)['flavor']).to eq('BYOS') + expect(response.parsed_body['flavor']).to eq('BYOS') expect(response.message).to eq('Unprocessable Content') expect(response.code).to eq('422') end diff --git a/engines/registry/spec/requests/api/connect/v3/systems/activations_controller_spec.rb b/engines/registry/spec/requests/api/connect/v3/systems/activations_controller_spec.rb index fb12b7a2f..8d6c0183c 100644 --- a/engines/registry/spec/requests/api/connect/v3/systems/activations_controller_spec.rb +++ b/engines/registry/spec/requests/api/connect/v3/systems/activations_controller_spec.rb @@ -19,7 +19,7 @@ context 'without X-Instance-Data headers or hw_info' do it 'does not update InstanceVerification cache' do get '/connect/systems/activations', headers: headers - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) expect(InstanceVerification).not_to receive(:update_cache) end @@ -83,7 +83,7 @@ registry: true ) get '/connect/systems/activations', headers: headers - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) end end @@ -144,7 +144,7 @@ ) get '/connect/systems/activations', headers: headers FileUtils.rm_rf('repo/payg/cache') - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) end end @@ -161,7 +161,7 @@ ) get '/connect/systems/activations', headers: headers FileUtils.rm_rf('repo/payg/cache') - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) end end @@ -299,7 +299,7 @@ allow_any_instance_of(InstanceVerification::Providers::Example).to receive(:instance_identifier).and_return('foo') get '/connect/systems/activations', headers: headers - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) expect(data[0]['service']['id']).to match(system.activations.first.service_id) expect(data[0]['service']['product']['id']).to match(system.activations.first.service_id) diff --git a/engines/scc_proxy/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb b/engines/scc_proxy/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb index 2404dd9ff..55c319a1a 100644 --- a/engines/scc_proxy/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb +++ b/engines/scc_proxy/spec/requests/api/connect/v3/subscriptions/systems_controller_spec.rb @@ -64,7 +64,7 @@ expect(InstanceVerification::Providers::Example).to receive(:new).at_least(:once).and_return(plugin_double) allow(plugin_double).to receive(:instance_identifier).and_raise(InstanceVerification::Exception, 'Malformed instance data') post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=' } - expect(JSON.parse(response.body)['error']).to eq('Malformed instance data') + expect(response.parsed_body['error']).to eq('Malformed instance data') expect(response.message).to eq('Unprocessable Content') expect(response.code).to eq('422') end @@ -83,7 +83,7 @@ it 'returns error' do post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } - data = JSON.parse(response.body) + data = response.parsed_body expect(response.code).to eq('401') expect(data['type']).to eq('error') expect(data['error']).to include('Invalid credentials') @@ -102,7 +102,7 @@ it 'returns error' do post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } - data = JSON.parse(response.body) + data = response.parsed_body expect(response.code).to eq('401') expect(data['type']).to eq('error') expect(data['error']).to include('Unauthorized') @@ -121,7 +121,7 @@ it 'returns error' do post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } - data = JSON.parse(response.body) + data = response.parsed_body expect(data['type']).to eq('error') expect(data['error']).to include('Request timed out') end @@ -219,7 +219,7 @@ allow(plugin_double).to receive(:instance_identifier).and_return('i-12345-payg') post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } expect(response.message).to eq('Unprocessable Content') - expect(JSON.parse(response.body)).to eq({ 'type' => 'error', 'error' => 'System could not be created: Record invalid' }) + expect(response.parsed_body).to eq({ 'type' => 'error', 'error' => 'System could not be created: Record invalid' }) expect(response.code).to eq('422') end end @@ -248,7 +248,7 @@ post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } expect(response.message).to eq('Created') expect(response.code).to eq('201') - expect(JSON.parse(response.body)['login']).to eq('i-12345-payg') + expect(response.parsed_body['login']).to eq('i-12345-payg') end end end @@ -266,7 +266,7 @@ it 'returns error' do post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } - data = JSON.parse(response.body) + data = response.parsed_body expect(response.code).to eq('401') expect(data['type']).to eq('error') expect(data['error']).to include('Invalid credentials') @@ -285,7 +285,7 @@ it 'returns error' do post '/connect/subscriptions/systems', params: params, headers: { HTTP_AUTHORIZATION: 'Token token=bar' } - data = JSON.parse(response.body) + data = response.parsed_body expect(data['type']).to eq('error') expect(data['error']).to include('timed out') end diff --git a/engines/scc_proxy/spec/requests/api/connect/v3/systems/products_controller_spec.rb b/engines/scc_proxy/spec/requests/api/connect/v3/systems/products_controller_spec.rb index 0a81c9363..1a84fa75f 100644 --- a/engines/scc_proxy/spec/requests/api/connect/v3/systems/products_controller_spec.rb +++ b/engines/scc_proxy/spec/requests/api/connect/v3/systems/products_controller_spec.rb @@ -138,7 +138,7 @@ system_byos.update!(system_token: nil) post url, params: payload_byos, headers: headers # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end @@ -158,7 +158,7 @@ end it 'renders an error with exception details' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to include('No product found on SCC') expect(data['error']).not_to include('json api') end @@ -192,7 +192,7 @@ it 'renders service JSON' do # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end @@ -228,7 +228,7 @@ it 'renders service JSON' do # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end end @@ -424,7 +424,7 @@ .to_return(status: 403, body: { ok: 'OK' }.to_json, headers: {}) post url, params: payload, headers: headers - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to include('Product not supported for this instance') end end @@ -521,7 +521,7 @@ post url, params: payload, headers: headers # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end context 'instance verification error' do @@ -531,7 +531,7 @@ expect(InstanceVerification::Providers::Example).to receive(:new).at_least(:once).and_return(plugin_double) allow(plugin_double).to receive(:allowed_extension?).and_raise(InstanceVerification::Exception, 'Malformed instance data') post url, params: payload, headers: headers - expect(JSON.parse(response.body)['error']).to eq('Malformed instance data') + expect(response.parsed_body['error']).to eq('Malformed instance data') expect(response.message).to eq('Unprocessable Content') expect(response.code).to eq('422') end @@ -553,7 +553,7 @@ it 'renders the error' do post url, params: payload, headers: headers - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to include('went wrong') end end @@ -570,7 +570,7 @@ it 'renders the error' do post url, params: payload, headers: headers - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to include('Bad Request') end end diff --git a/engines/scc_proxy/spec/requests/api/connect/v3/systems/systems_controller_spec.rb b/engines/scc_proxy/spec/requests/api/connect/v3/systems/systems_controller_spec.rb index f34d58446..5a2768a37 100644 --- a/engines/scc_proxy/spec/requests/api/connect/v3/systems/systems_controller_spec.rb +++ b/engines/scc_proxy/spec/requests/api/connect/v3/systems/systems_controller_spec.rb @@ -84,7 +84,7 @@ "Could not de-activate system #{system.login}, error: Oh oh, something went wrong 422" ).once ) - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Oh oh, something went wrong') end end diff --git a/engines/scc_proxy/spec/requests/api/connect/v4/systems/products_controller_spec.rb b/engines/scc_proxy/spec/requests/api/connect/v4/systems/products_controller_spec.rb index 6a4975c64..fabe7c203 100644 --- a/engines/scc_proxy/spec/requests/api/connect/v4/systems/products_controller_spec.rb +++ b/engines/scc_proxy/spec/requests/api/connect/v4/systems/products_controller_spec.rb @@ -52,7 +52,7 @@ ).once ) # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end @@ -86,7 +86,7 @@ end it 'reports an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Could not de-activate product \'SUSE Linux Enterprise Server 15 SP3 x86_64\'') end end @@ -106,7 +106,7 @@ before { delete url, params: payload, headers: headers } it 'reports an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq("The product \"#{product.name}\" is a base product and cannot be deactivated") end end @@ -157,7 +157,7 @@ ).once ) # Compare parsed JSON to avoid encoding issues (UTF-8 vs ASCII-8BIT) - expect(JSON.parse(response.body)).to eq(JSON.parse(serialized_service_json)) + expect(response.parsed_body).to eq(JSON.parse(serialized_service_json)) end end @@ -187,7 +187,7 @@ end it 'reports an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq("{\"error\": \"Error'\"}") expect(SccProxy).to have_received(:headers).with(headers['HTTP_AUTHORIZATION'], nil) end @@ -273,7 +273,7 @@ "Could not de-activate system #{system_hybrid.login}, error: Oh oh, something went wrong 422" ).once ) - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq('Oh oh, something went wrong') end end @@ -344,7 +344,7 @@ before { delete url, params: payload, headers: headers } it 'reports an error' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data['error']).to eq("The product \"#{product.name}\" is a base product and cannot be deactivated") end end diff --git a/engines/scc_suma_api/spec/requests/scc_suma_api/scc_suma_api_controller_spec.rb b/engines/scc_suma_api/spec/requests/scc_suma_api/scc_suma_api_controller_spec.rb index 4103b8aaa..859eed3b5 100644 --- a/engines/scc_suma_api/spec/requests/scc_suma_api/scc_suma_api_controller_spec.rb +++ b/engines/scc_suma_api/spec/requests/scc_suma_api/scc_suma_api_controller_spec.rb @@ -121,7 +121,7 @@ module SccSumaApi it 'raise an exception' do expect(response.code).to eq '422' - expect(JSON.parse(response.body)['error']).to eq 'Missing signature' + expect(response.parsed_body['error']).to eq 'Missing signature' end end end diff --git a/engines/zypper_auth/spec/requests/api/connect/v3/systems/activations_controller_spec.rb b/engines/zypper_auth/spec/requests/api/connect/v3/systems/activations_controller_spec.rb index d9c18eb8c..95874ffa0 100644 --- a/engines/zypper_auth/spec/requests/api/connect/v3/systems/activations_controller_spec.rb +++ b/engines/zypper_auth/spec/requests/api/connect/v3/systems/activations_controller_spec.rb @@ -18,7 +18,7 @@ context 'without X-Instance-Data headers or hw_info' do it 'has service URLs with HTTP scheme' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) expect(plugin_double).not_to receive(:instance_valid?) expect(InstanceVerification).not_to receive(:update_cache) @@ -29,7 +29,7 @@ let(:system) { FactoryBot.create(:system, :with_activated_product, :with_system_information, instance_data: 'plugin:susecloud') } it 'has service URLs with HTTP scheme' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) expect(plugin_double).not_to receive(:instance_valid?) expect(InstanceVerification).not_to receive(:update_cache) @@ -40,7 +40,7 @@ let(:headers) { auth_header.merge(version_header).merge({ 'X-Instance-Data' => Base64.strict_encode64('instance_data') }) } it 'has service URLs with HTTP scheme' do - data = JSON.parse(response.body) + data = response.parsed_body expect(data[0]['service']['url']).to match(%r{^plugin:/susecloud}) expect(plugin_double).not_to receive(:instance_identifier) # system is PAYG, no need for IID end diff --git a/engines/zypper_auth/spec/requests/api/connect/v3/systems/products_controller_spec.rb b/engines/zypper_auth/spec/requests/api/connect/v3/systems/products_controller_spec.rb index cc4d291de..fae8bde33 100644 --- a/engines/zypper_auth/spec/requests/api/connect/v3/systems/products_controller_spec.rb +++ b/engines/zypper_auth/spec/requests/api/connect/v3/systems/products_controller_spec.rb @@ -4,7 +4,7 @@ include_context 'version header', 3 describe '#activate' do - subject(:service_url) { JSON.parse(response.body)['url'] } + subject(:service_url) { response.parsed_body['url'] } let(:url) { connect_systems_products_url } let(:headers) { auth_header.merge(version_header) }