Skip to content

Commit

Permalink
Skip the license agreement if already accepted.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 29, 2018
1 parent a7c0125 commit 9059ecc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib/y2packager/clients/inst_product_upgrade_license.rb
Expand Up @@ -25,7 +25,8 @@ module Clients
# This client shows a license confirmation dialog for the upgraded base product
#
# The client will display an error and return :back if not product is found.
# If no license is found for the selected product it returns :auto.
# It returns true if no license is found or if the license was already
# accepted for the selected product.
# The license is not displayed when going back in the workflow.
# @see Y2Packager::Clients::InstProductLicense
class InstProductUpgradeLicense < InstProductLicense
Expand All @@ -43,7 +44,7 @@ def main
return :back
end

return :auto unless available_license?
return :auto if !available_license? || license_confirmed?

log.info "Displaying license for product: #{product.inspect}"

Expand Down
5 changes: 5 additions & 0 deletions test/lib/clients/inst_product_upgrade_license_test.rb
Expand Up @@ -56,6 +56,11 @@
expect(subject.main).to eq(:auto)
end

it "returns :auto if the product license was already accepted" do
expect(product).to receive(:license_confirmed?).at_least(:once).and_return(true)
expect(subject.main).to eq(:auto)
end

it "displays the product license" do
allow(Yast::Language).to receive(:language).and_return("en_US")
expect_any_instance_of(Y2Packager::Dialogs::InstProductLicense).to receive(:run)
Expand Down

0 comments on commit 9059ecc

Please sign in to comment.