Skip to content

Commit

Permalink
Merge pull request #535 from yast/logging
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Sep 21, 2020
2 parents 1566bbb + 413ebd3 commit fb943b8
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package/yast2-packager.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Mon Sep 21 08:30:04 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

- Fixed WFM.Args call to not produce an error message in the y2log
(bsc#1176653)
- 4.3.8

-------------------------------------------------------------------
Wed Sep 16 12:17:07 UTC 2020 - Ladislav Slezák <lslezak@suse.cz>

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


Name: yast2-packager
Version: 4.3.7
Version: 4.3.8
Release: 0
Summary: YaST2 - Package Library
License: GPL-2.0-or-later
Expand Down
2 changes: 2 additions & 0 deletions src/lib/y2packager/medium_type.rb
Expand Up @@ -80,6 +80,8 @@ def standard?
# @return [Boolean] True if the client should be skipped.
#
def skip_step?
return false if Yast::WFM.Args.empty?

skip = Yast::WFM.Args(0) && Yast::WFM.Args(0)["skip"]
return true if skip&.split(",")&.include?(type.to_s)

Expand Down
21 changes: 15 additions & 6 deletions test/medium_type_test.rb
Expand Up @@ -92,34 +92,43 @@
end
end

def mock_arguments(arg)
allow(Yast::WFM).to receive(:Args).and_return([arg])
allow(Yast::WFM).to receive(:Args).with(0).and_return(arg)
end

describe "#skip_step?" do
context "online installation medium" do
before do
allow(Y2Packager::MediumType).to receive(:type).and_return(:online)
end

it "returns true if the client args contain \"skip\" => \"online\"" do
allow(Yast::WFM).to receive(:Args).with(0).and_return("skip" => "online")
mock_arguments("skip" => "online")
expect(Y2Packager::MediumType.skip_step?).to eq(true)
end
it "returns true if the client args contain \"skip\" => \"standard,online\"" do
allow(Yast::WFM).to receive(:Args).with(0).and_return("skip" => "standard,online")
mock_arguments("skip" => "standard,online")
expect(Y2Packager::MediumType.skip_step?).to eq(true)
end
it "returns false if the client args do not contain \"skip\" => \"online\"" do
allow(Yast::WFM).to receive(:Args).with(0).and_return({})
mock_arguments({})
expect(Y2Packager::MediumType.skip_step?).to eq(false)
end
it "returns false if the client args contain \"only\" => \"online\"" do
allow(Yast::WFM).to receive(:Args).with(0).and_return("only" => "online")
mock_arguments("only" => "online")
expect(Y2Packager::MediumType.skip_step?).to eq(false)
end
it "returns false if the client args contain \"only\" => \"online,standard\"" do
allow(Yast::WFM).to receive(:Args).with(0).and_return("only" => "standard,online")
mock_arguments("only" => "standard,online")
expect(Y2Packager::MediumType.skip_step?).to eq(false)
end
it "returns false if the client args do not contain \"only\" => \"online\"" do
allow(Yast::WFM).to receive(:Args).with(0).and_return({})
mock_arguments({})
expect(Y2Packager::MediumType.skip_step?).to eq(false)
end
it "returns false if the client args are empty" do
allow(Yast::WFM).to receive(:Args).and_return([])
expect(Y2Packager::MediumType.skip_step?).to eq(false)
end
end
Expand Down

0 comments on commit fb943b8

Please sign in to comment.