Skip to content

Commit

Permalink
Fix valid_imported_values test
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jul 29, 2020
1 parent e846106 commit bd070af
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions test/AutoInstall_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,46 @@ def self.new_from_hashes(_hash)

describe "#valid_imported_values" do
before(:each) do
subject.issues_list = ::Installation::AutoinstIssues::List.new
subject.main
allow(Yast::Report).to receive(:Export).and_return(report_settings)
allow(Test::AutoinstProfile::FirewallSection).to receive(:new_from_hashes)
.and_return(fw_section)
end

let(:report_settings) do
{
"errors" => { "log" => true, "show" => false, "timeout" => 0 },
"warnings" => { "log" => true, "show" => true, "timeout" => 0 }
}
end

let(:fw_section) { Test::AutoinstProfile::FirewallSection.new }

context "when no issue has been found" do
it "returns true" do
expect(subject.valid_imported_values).to eq(true)
end
end

context "when an issue has been found" do
let(:fw_section) { Test::AutoinstProfile::FirewallSection.new }

before do
allow(Test::AutoinstProfile::FirewallSection).to receive(:new_from_hashes)
.and_return(fw_section)
end

it "shows a popup" do
subject.issues_list.add(
::Installation::AutoinstIssues::InvalidValue,
fw_section, "FW_DEV_INT", "1",
_("Is not supported anymore.")
_("Is not supported anymore."),
)
expect_any_instance_of(Y2Autoinstallation::Dialogs::Question).to receive(:run)
.and_return(:ok)
expect(subject.valid_imported_values).to eq(true)
end
end

context "when a fatal issue is found" do
it "shows a popup eve if error reporting is disabled" do
subject.issues_list.add(
::Installation::AutoinstIssues::InvalidValue,
fw_section, "FW_DEV_INT", "X",
_("Is not supported anymore."), :fatal
)
expect_any_instance_of(Y2Autoinstallation::Dialogs::Question).to receive(:run)
.and_return(:ok)
Expand Down

0 comments on commit bd070af

Please sign in to comment.