Skip to content

Commit

Permalink
Merge pull request #199 from yast/catch_exceptions
Browse files Browse the repository at this point in the history
Catch exceptions also when loading the available extensions (bsc#941491)
  • Loading branch information
lslezak committed Aug 14, 2015
2 parents 856eb1c + 45876e3 commit 03796ed
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 deletions.
7 changes: 7 additions & 0 deletions package/yast2-registration.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Aug 14 16:01:41 UTC 2015 - lslezak@suse.cz

- Catch exceptions also when loading the available extensions
(bsc#941491)
- 3.1.141

-------------------------------------------------------------------
Fri Aug 14 15:11:37 UTC 2015 - ancor@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-registration.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-registration
Version: 3.1.140
Version: 3.1.141
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down
6 changes: 5 additions & 1 deletion src/clients/inst_scc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ def get_available_addons
# cache the available addons
return :cancel if init_registration == :cancel

registration_ui.get_available_addons
addons_loaded = Registration::ConnectHelpers.catch_registration_errors do
registration_ui.get_available_addons
end

return :cancel unless addons_loaded

@addons_registered_orig = Registration::Addon.registered.dup
end
Expand Down
16 changes: 16 additions & 0 deletions test/inst_scc_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
expect(Yast::WFM.call("inst_scc")).to eq(:abort)
end

it "displays an error when loading the available extensions fails" do
error = "Invalid system credentials"
# click installing extensions, abort the workflow
expect(Yast::UI).to receive(:UserInput).and_return(:extensions, :abort)

expect(Yast::Report).to receive(:Error) do |msg|
# make sure the propoer error is displayed
expect(msg).to include(error)
end

expect_any_instance_of(Registration::RegistrationUI).to receive(:get_available_addons)
.and_raise(error)

expect(Yast::WFM.call("inst_scc")).to eq(:abort)
end

it "goes back to initial screen when aborting selection of url" do
# User clicks on 'select extensions' first time the initial screen is
# displayed and 'finish' the second time
Expand Down

0 comments on commit 03796ed

Please sign in to comment.