Skip to content

Commit

Permalink
adapt tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 22, 2021
1 parent 02bf9fd commit a8e406f
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions test/lib/clients/inst_autoinit_test.rb
Expand Up @@ -35,7 +35,7 @@
allow(Yast::Profile).to receive(:current).and_return(Yast::ProfileHash.new)
allow(Yast::Mode).to receive(:autoupgrade).and_return(true)
allow(Yast::AutoinstFunctions).to receive(:available_base_products).and_return([])
allow(Y2Packager::MediumType).to receive(:online?).and_return(true)
allow(Yast::InstallationMedium).to receive(:contain_multi_repos?).and_return(false)
allow(Y2Packager::ProductSpec).to receive(:base_products).and_return([sles_spec])
Yast::AutoinstConfig.ProfileInRootPart = false
end
Expand Down Expand Up @@ -104,17 +104,13 @@
subject.run
end

context "when using the Full medium" do
it "reports an error when the product is not specified" do
allow(Y2Packager::MediumType).to receive(:online?).and_return(false)
allow(Y2Packager::MediumType).to receive(:offline?).and_return(true)
allow(Yast::Mode).to receive(:autoupgrade).and_return(false)
allow(Yast::InstURL).to receive(:installInf2Url).and_return("")
it "reports an error when the product is not specified" do
allow(Yast::Mode).to receive(:autoupgrade).and_return(false)
allow(Yast::InstURL).to receive(:installInf2Url).and_return("")

expect(Yast::Popup).to receive(:LongError)
expect(Yast::Popup).to receive(:LongError)

expect(subject.run).to eq :abort
end
expect(subject.run).to eq :abort
end

context "when using the Online medium for an installation" do
Expand Down Expand Up @@ -166,20 +162,20 @@
expect(subject.run).to eq :abort
end
end
end

context "and the registration is enabled according to the profile" do
let(:do_registration) { true }
context "and the registration is enabled according to the profile" do
let(:do_registration) { true }

it "registers the system" do
expect(Yast::WFM).to receive(:CallFunction)
.with("scc_auto", ["Import", profile["suse_register"]])
expect(Yast::WFM).to receive(:CallFunction).with("scc_auto", ["Write"])
# fake that registration is available to avoid build requires
allow(subject).to receive(:registration_module_available?).and_return(true)
allow(Yast::Profile).to receive(:remove_sections)
it "registers the system" do
expect(Yast::WFM).to receive(:CallFunction)
.with("scc_auto", ["Import", profile["suse_register"]])
expect(Yast::WFM).to receive(:CallFunction).with("scc_auto", ["Write"])
# fake that registration is available to avoid build requires
allow(subject).to receive(:registration_module_available?).and_return(true)
allow(Yast::Profile).to receive(:remove_sections)

subject.run
end
subject.run
end
end

Expand Down

0 comments on commit a8e406f

Please sign in to comment.