Skip to content

Commit

Permalink
Merge pull request #304 from imobach/fix-relnotes-retrieval
Browse files Browse the repository at this point in the history
Fix release notes loading when network is not working
  • Loading branch information
imobachgs committed Aug 7, 2015
2 parents ea34a36 + 3c3cb4f commit 09f7c08
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
6 changes: 6 additions & 0 deletions package/yast2-installation.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Aug 7 12:53:08 UTC 2015 - igonzalezsosa@suse.com

- Fix release notes loading when network is not working (bsc#940648)
- 3.1.153

-------------------------------------------------------------------
Wed Aug 5 11:45:25 UTC 2015 - jsrain@suse.cz

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-installation.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-installation
Version: 3.1.152
Version: 3.1.153
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
2 changes: 1 addition & 1 deletion src/lib/installation/clients/inst_system_analysis.rb
Expand Up @@ -293,7 +293,7 @@ def download_and_show_release_notes
# try on-line release notes first
WFM.CallFunction("inst_download_release_notes")

if !InstData.release_notes.empty? &&
if !InstData.release_notes.empty? ||
!load_release_notes(Packages.GetBaseSourceID)
return
end
Expand Down
62 changes: 62 additions & 0 deletions test/inst_system_analysis_test.rb
@@ -0,0 +1,62 @@
#!/usr/bin/env rspec

require_relative "./test_helper"
require "installation/clients/inst_system_analysis"

Yast.import "Product"
Yast.import "InstData"
Yast.import "Packages"

describe Yast::InstSystemAnalysisClient do
describe "#download_and_show_release_notes" do
let(:product) { "openSUSE" }
let(:notes) { "some release notes" }

before do
allow(Yast::WFM).to receive(:CallFunction).with("inst_download_release_notes")
.and_return(:auto)
allow(Yast::Product).to receive(:short_name).and_return(product)
allow(Yast::InstData).to receive(:release_notes).and_return(release_notes)
end

context "when release notes were downloaded" do
let(:release_notes) { { product => notes } }

it "does not enable the button nor load release notes again" do
expect(Yast::Wizard).to_not receive(:ShowReleaseNotesButton)
expect(Yast::UI).to_not receive(:SetReleaseNotes)
subject.download_and_show_release_notes
end
end

context "when release notes were not downloaded" do
let(:release_notes) { {} }

context "but can be loaded from media" do
before do
allow(subject).to receive(:load_release_notes).and_return(true)
subject.instance_variable_set(:@media_text, notes)
end

it "enables the button and load the release notes" do
expect(Yast::Wizard).to receive(:ShowReleaseNotesButton)
expect(Yast::UI).to receive(:SetReleaseNotes).with(product => notes)
subject.download_and_show_release_notes
expect(Yast::InstData.release_notes).to eq(product => notes)
end
end

context "and could not be loaded from media" do
before do
allow(subject).to receive(:load_release_notes).and_return(false)
end

it "does not enable the button nor load release notes" do
expect(Yast::Wizard).to_not receive(:ShowReleaseNotesButton)
expect(Yast::UI).to_not receive(:SetReleaseNotes)
subject.download_and_show_release_notes
end
end
end
end
end

0 comments on commit 09f7c08

Please sign in to comment.