File obs-server-2.10-0032-Replace-positional-arguments-by-keyword-arguments-in.patch of Package obs-server

From 020355c6176d6d020e6d89548aae86b9e28b8476 Mon Sep 17 00:00:00 2001
From: Dany Marcoux <danymarcoux@gmail.com>
Date: Thu, 15 Aug 2019 13:19:32 +0200
Subject: [PATCH] Replace positional arguments by keyword arguments in Faker
 calls

This is to follow changes introduced in the 2.0 of Faker
---
 .../spec/bootstrap/features/webui/projects_spec.rb   |  2 +-
 .../source/key_info_controller_controller_spec.rb    |  4 ++--
 .../webui/projects/public_key_controller_spec.rb     |  2 +-
 .../projects/ssl_certificate_controller_spec.rb      |  4 ++--
 .../maintenance_statistic_decorator_spec.rb          |  4 ++--
 .../spec/factories/bs_request_action_accept_info.rb  | 10 +++++-----
 src/api/spec/factories/ec2_configuration.rb          |  4 ++--
 src/api/spec/factories/issue_tracker.rb              |  4 ++--
 src/api/spec/factories/kiwi_package.rb               |  4 ++--
 src/api/spec/factories/kiwi_package_group.rb         |  2 +-
 src/api/spec/factories/tokens.rb                     |  2 +-
 src/api/spec/features/webui/projects_spec.rb         |  2 +-
 .../spec/models/event/comment_for_project_spec.rb    |  4 ++--
 src/api/spec/models/review_spec.rb                   | 12 ++++++------
 .../models/statistics/maintenance_statistic_spec.rb  |  2 +-
 src/api/test/functional/source_controller_test.rb    |  4 ++--
 src/api/test/unit/package_test.rb                    |  2 +-
 17 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/src/api/spec/bootstrap/features/webui/projects_spec.rb b/src/api/spec/bootstrap/features/webui/projects_spec.rb
index 3ee1e8847d..65a1b02fe2 100644
--- a/src/api/spec/bootstrap/features/webui/projects_spec.rb
+++ b/src/api/spec/bootstrap/features/webui/projects_spec.rb
@@ -5,7 +5,7 @@ RSpec.feature 'Bootstrap_Projects', type: :feature, js: true, vcr: true do
   let(:project) { user.home_project }
   let!(:admin_user) { create(:admin_user) }
   describe 'creating packages in projects owned by user, eg. home projects' do
-    let(:very_long_description) { Faker::Lorem.paragraph(20) }
+    let(:very_long_description) { Faker::Lorem.paragraph(sentence_count: 20) }
 
     before do
       login user
diff --git a/src/api/spec/controllers/source/key_info_controller_controller_spec.rb b/src/api/spec/controllers/source/key_info_controller_controller_spec.rb
index c5e4357c6c..e5536b40a1 100644
--- a/src/api/spec/controllers/source/key_info_controller_controller_spec.rb
+++ b/src/api/spec/controllers/source/key_info_controller_controller_spec.rb
@@ -5,8 +5,8 @@ RSpec.describe Source::KeyInfoController, type: :controller do
   describe 'GET #show' do
     let(:user) { create(:confirmed_user) }
     let(:project) { create(:project, name: 'test_project', title: 'Test Project') }
-    let(:gpg_public_key) { Faker::Lorem.characters(1024) }
-    let(:ssl_certificate) { Faker::Lorem.characters(1024) }
+    let(:gpg_public_key) { Faker::Lorem.characters(number: 1024) }
+    let(:ssl_certificate) { Faker::Lorem.characters(number: 1024) }
     let(:keyinfo_response) do
       <<-XML
         <keyinfo project="Test">
diff --git a/src/api/spec/controllers/webui/projects/public_key_controller_spec.rb b/src/api/spec/controllers/webui/projects/public_key_controller_spec.rb
index 2ee55a41a1..fb9035b83d 100644
--- a/src/api/spec/controllers/webui/projects/public_key_controller_spec.rb
+++ b/src/api/spec/controllers/webui/projects/public_key_controller_spec.rb
@@ -15,7 +15,7 @@ RSpec.describe Webui::Projects::PublicKeyController, type: :controller do
     end
 
     context 'with a project that has a public key' do
-      let(:gpg_public_key) { Faker::Lorem.characters(1024) }
+      let(:gpg_public_key) { Faker::Lorem.characters(number: 1024) }
       let(:keyinfo_response) do
         <<-XML
           <keyinfo project="Test">
diff --git a/src/api/spec/controllers/webui/projects/ssl_certificate_controller_spec.rb b/src/api/spec/controllers/webui/projects/ssl_certificate_controller_spec.rb
index f075a5d237..f01dd25429 100644
--- a/src/api/spec/controllers/webui/projects/ssl_certificate_controller_spec.rb
+++ b/src/api/spec/controllers/webui/projects/ssl_certificate_controller_spec.rb
@@ -4,7 +4,7 @@ require 'webmock/rspec'
 RSpec.describe Webui::Projects::SslCertificateController, type: :controller do
   describe 'GET #show' do
     let(:project) { create(:project, name: 'test_project', title: 'Test Project') }
-    let(:gpg_public_key) { Faker::Lorem.characters(1024) }
+    let(:gpg_public_key) { Faker::Lorem.characters(number: 1024) }
 
     before do
       Rails.cache.clear
@@ -16,7 +16,7 @@ RSpec.describe Webui::Projects::SslCertificateController, type: :controller do
     end
 
     context 'with a project that has an ssl certificate' do
-      let(:ssl_certificate) { Faker::Lorem.characters(1024) }
+      let(:ssl_certificate) { Faker::Lorem.characters(number: 1024) }
       let(:keyinfo_response) do
         <<-XML
           <keyinfo project="Test">
diff --git a/src/api/spec/decorators/statistics/maintenance_statistic_decorator_spec.rb b/src/api/spec/decorators/statistics/maintenance_statistic_decorator_spec.rb
index 51bcdf0b4b..7eda4233fb 100644
--- a/src/api/spec/decorators/statistics/maintenance_statistic_decorator_spec.rb
+++ b/src/api/spec/decorators/statistics/maintenance_statistic_decorator_spec.rb
@@ -8,7 +8,7 @@ RSpec.describe Statistics::MaintenanceStatisticDecorator do
         type: :issue_created,
         name: Faker::Lorem.word,
         tracker: Faker::Lorem.word,
-        when: Faker::Date.forward(10)
+        when: Faker::Date.forward(days: 10)
       )
     end
     let(:expected_xml_hash1) do
@@ -25,7 +25,7 @@ RSpec.describe Statistics::MaintenanceStatisticDecorator do
         type: :review_accepted,
         who: Faker::Lorem.word,
         id: rand(100),
-        when: Faker::Date.forward(10)
+        when: Faker::Date.forward(days: 10)
       )
     end
     let(:expected_xml_hash2) do
diff --git a/src/api/spec/factories/bs_request_action_accept_info.rb b/src/api/spec/factories/bs_request_action_accept_info.rb
index ef5d461591..66524f2cae 100644
--- a/src/api/spec/factories/bs_request_action_accept_info.rb
+++ b/src/api/spec/factories/bs_request_action_accept_info.rb
@@ -1,11 +1,11 @@
 FactoryBot.define do
   factory :bs_request_action_accept_info do
     factory :bs_request_action_accept_info_with_action do
-      rev { Faker::Number.hexadecimal(10) }
-      srcmd5 { Faker::Number.hexadecimal(10) }
-      xsrcmd5 { Faker::Number.hexadecimal(10) }
-      osrcmd5 { Faker::Number.hexadecimal(10) }
-      oxsrcmd5 { Faker::Number.hexadecimal(10) }
+      rev { Faker::Number.hexadecimal(digits: 10) }
+      srcmd5 { Faker::Number.hexadecimal(digits: 10) }
+      xsrcmd5 { Faker::Number.hexadecimal(digits: 10) }
+      osrcmd5 { Faker::Number.hexadecimal(digits: 10) }
+      oxsrcmd5 { Faker::Number.hexadecimal(digits: 10) }
       oproject { Faker::Lorem.word }
       opackage { Faker::Lorem.word }
       bs_request_action
diff --git a/src/api/spec/factories/ec2_configuration.rb b/src/api/spec/factories/ec2_configuration.rb
index 00948fb18c..eb8c9e23dc 100644
--- a/src/api/spec/factories/ec2_configuration.rb
+++ b/src/api/spec/factories/ec2_configuration.rb
@@ -1,7 +1,7 @@
 FactoryBot.define do
   factory :ec2_configuration, class: Cloud::Ec2::Configuration do
     user
-    arn { "arn:#{Faker::Lorem.characters(10)}" }
-    external_id { Faker::Lorem.characters(24) }
+    arn { "arn:#{Faker::Lorem.characters(number: 10)}" }
+    external_id { Faker::Lorem.characters(number: 24) }
   end
 end
diff --git a/src/api/spec/factories/issue_tracker.rb b/src/api/spec/factories/issue_tracker.rb
index f27ba0d84e..718d58804a 100644
--- a/src/api/spec/factories/issue_tracker.rb
+++ b/src/api/spec/factories/issue_tracker.rb
@@ -3,8 +3,8 @@ FactoryBot.define do
     name { 'gh' }
     description { Faker::Lorem.paragraph }
     kind { 'github' }
-    url { Faker::Internet.url('example.com') }
-    show_url { Faker::Internet.url('example.com') }
+    url { Faker::Internet.url(host: 'example.com') }
+    show_url { Faker::Internet.url(host: 'example.com') }
     regex { 'gh#(\d+)' }
     label { Faker::Lorem.word }
     issues_updated { Time.now }
diff --git a/src/api/spec/factories/kiwi_package.rb b/src/api/spec/factories/kiwi_package.rb
index 2a7b366df9..9a73ce5a5c 100644
--- a/src/api/spec/factories/kiwi_package.rb
+++ b/src/api/spec/factories/kiwi_package.rb
@@ -9,7 +9,7 @@ FactoryBot.define do
     name        { Faker::Creature::Cat.name }
     arch        { Faker::Creature::Cat.name }
     replaces    { Faker::Creature::Cat.name }
-    bootinclude { Faker::Boolean.boolean(0.4) }
-    bootdelete  { Faker::Boolean.boolean(0.2) }
+    bootinclude { Faker::Boolean.boolean(true_ratio: 0.4) }
+    bootdelete  { Faker::Boolean.boolean(true_ratio: 0.2) }
   end
 end
diff --git a/src/api/spec/factories/kiwi_package_group.rb b/src/api/spec/factories/kiwi_package_group.rb
index 5c378b7314..56e47d8859 100644
--- a/src/api/spec/factories/kiwi_package_group.rb
+++ b/src/api/spec/factories/kiwi_package_group.rb
@@ -2,7 +2,7 @@ FactoryBot.define do
   factory :kiwi_package_group, class: Kiwi::PackageGroup do
     association :image, factory: :kiwi_image
 
-    kiwi_type { Kiwi::PackageGroup.kiwi_types.keys[Faker::Number.between(0, Kiwi::PackageGroup.kiwi_types.keys.length - 1)] }
+    kiwi_type { Kiwi::PackageGroup.kiwi_types.keys[Faker::Number.between(from: 0, to: Kiwi::PackageGroup.kiwi_types.keys.length - 1)] }
     profiles { Faker::Creature::Cat.name }
     pattern_type { Faker::Creature::Cat.name }
 
diff --git a/src/api/spec/factories/tokens.rb b/src/api/spec/factories/tokens.rb
index b4c4f025aa..57f47478cd 100644
--- a/src/api/spec/factories/tokens.rb
+++ b/src/api/spec/factories/tokens.rb
@@ -1,6 +1,6 @@
 FactoryBot.define do
   factory :token do
-    string { Faker::Lorem.characters(32) }
+    string { Faker::Lorem.characters(number: 32) }
 
     factory :service_token, class: Token::Service do
       type { 'Token::Service' }
diff --git a/src/api/spec/features/webui/projects_spec.rb b/src/api/spec/features/webui/projects_spec.rb
index 5bf5de9410..f666796348 100644
--- a/src/api/spec/features/webui/projects_spec.rb
+++ b/src/api/spec/features/webui/projects_spec.rb
@@ -38,7 +38,7 @@ RSpec.feature 'Projects', type: :feature, js: true do
   end
 
   describe 'creating packages in projects owned by user, eg. home projects' do
-    let(:very_long_description) { Faker::Lorem.paragraph(20) }
+    let(:very_long_description) { Faker::Lorem.paragraph(sentence_count: 20) }
 
     before do
       login user
diff --git a/src/api/spec/models/event/comment_for_project_spec.rb b/src/api/spec/models/event/comment_for_project_spec.rb
index f2eb48018a..95e9c71ae8 100644
--- a/src/api/spec/models/event/comment_for_project_spec.rb
+++ b/src/api/spec/models/event/comment_for_project_spec.rb
@@ -17,7 +17,7 @@ RSpec.describe Event::CommentForProject do
     subject! { event.save }
 
     context 'with the payload small enough to fit into the payload column' do
-      let(:comment_body) { Faker::Lorem.characters(50) }
+      let(:comment_body) { Faker::Lorem.characters(number: 50) }
 
       it { expect(event).to be_persisted }
       it { expect(event.payload['comment_body'].bytesize).to eq(50) }
@@ -26,7 +26,7 @@ RSpec.describe Event::CommentForProject do
     context 'with the comment body too long for the payload column' do
       # The events.payload column has a max char limit of 65535 so this comment cannot fit
       # in the payload unless it is shortened
-      let(:comment_body) { Faker::Lorem.characters(65_535) }
+      let(:comment_body) { Faker::Lorem.characters(number: 65_535) }
       let(:event) do
         Event::CommentForProject.new(
           project: project.name,
diff --git a/src/api/spec/models/review_spec.rb b/src/api/spec/models/review_spec.rb
index 2ed927974e..f8b7740b48 100644
--- a/src/api/spec/models/review_spec.rb
+++ b/src/api/spec/models/review_spec.rb
@@ -148,7 +148,7 @@ RSpec.describe Review do
         :history_element_review_accepted,
         review: review,
         user: user,
-        created_at: Faker::Time.forward(1)
+        created_at: Faker::Time.forward(days: 1)
       )
     end
 
@@ -166,7 +166,7 @@ RSpec.describe Review do
           :history_element_review_accepted,
           review: review2,
           user: user,
-          created_at: Faker::Time.forward(2)
+          created_at: Faker::Time.forward(days: 2)
         )
       end
 
@@ -181,7 +181,7 @@ RSpec.describe Review do
           :review,
           by_user: user.login,
           review_id: review.id,
-          updated_at: Faker::Time.forward(2),
+          updated_at: Faker::Time.forward(days: 2),
           state: :new
         )
       end
@@ -221,7 +221,7 @@ RSpec.describe Review do
         :history_element_review_declined,
         review: review,
         user: user,
-        created_at: Faker::Time.forward(1)
+        created_at: Faker::Time.forward(days: 1)
       )
     end
 
@@ -239,7 +239,7 @@ RSpec.describe Review do
           :history_element_review_declined,
           review: review2,
           user: user,
-          created_at: Faker::Time.forward(2)
+          created_at: Faker::Time.forward(days: 2)
         )
       end
 
@@ -254,7 +254,7 @@ RSpec.describe Review do
           :review,
           by_user: user.login,
           review_id: review.id,
-          updated_at: Faker::Time.forward(2),
+          updated_at: Faker::Time.forward(days: 2),
           state: :new
         )
       end
diff --git a/src/api/spec/models/statistics/maintenance_statistic_spec.rb b/src/api/spec/models/statistics/maintenance_statistic_spec.rb
index e161c54d31..337e0e6ecb 100644
--- a/src/api/spec/models/statistics/maintenance_statistic_spec.rb
+++ b/src/api/spec/models/statistics/maintenance_statistic_spec.rb
@@ -150,7 +150,7 @@ RSpec.describe Statistics::MaintenanceStatistic do
           :history_element_review_accepted,
           review: new_review,
           user: user,
-          created_at: Faker::Time.forward(2)
+          created_at: Faker::Time.forward(days: 2)
         )
         new_review.state = :accepted
         new_review.save!
diff --git a/src/api/test/functional/source_controller_test.rb b/src/api/test/functional/source_controller_test.rb
index 0038523115..a646dd6109 100644
--- a/src/api/test/functional/source_controller_test.rb
+++ b/src/api/test/functional/source_controller_test.rb
@@ -4077,7 +4077,7 @@ class SourceControllerTest < ActionDispatch::IntegrationTest
 
   def test_store_invalid_package
     login_tom
-    name = Faker::Lorem.characters(255)
+    name = Faker::Lorem.characters(number: 255)
     url = url_for(controller: :source_project_package_meta, action: :update, project: 'home:tom', package: name)
     put url, params: "<package name='#{name}' project='home:tom'> <title/> <description/></package>"
     assert_response 400
@@ -4089,7 +4089,7 @@ class SourceControllerTest < ActionDispatch::IntegrationTest
 
   def test_store_invalid_project
     login_tom
-    name = "home:tom:#{Faker::Lorem.characters(255)}"
+    name = "home:tom:#{Faker::Lorem.characters(number: 255)}"
     url = url_for(controller: :source_project_meta, action: :update, project: name)
     put url, params: "<project name='#{name}'> <title/> <description/></project>"
     assert_response 400
diff --git a/src/api/test/unit/package_test.rb b/src/api/test/unit/package_test.rb
index 16842536ae..1440bfa0ff 100644
--- a/src/api/test/unit/package_test.rb
+++ b/src/api/test/unit/package_test.rb
@@ -216,7 +216,7 @@ class PackageTest < ActiveSupport::TestCase
     assert_raise(ActiveRecord::RecordInvalid) do
       @package.save!
     end
-    @package.name = Faker::Lorem.characters(255)
+    @package.name = Faker::Lorem.characters(number: 255)
     e = assert_raise(ActiveRecord::RecordInvalid) do
       @package.save!
     end
-- 
2.31.1