Skip to content

Commit

Permalink
updated testcases
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Oct 1, 2020
1 parent 48b9569 commit 1082c2d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
6 changes: 3 additions & 3 deletions test/data/zypp/opensuse_sles.yml
Expand Up @@ -18,7 +18,7 @@
- http://doc.opensuse.org/release-notes/x86_64/openSUSE/15.1/release-notes-openSUSE.rpm
short_name: openSUSE
source: -1
status: :installed
status: :removed
summary: openSUSE 15.1
transact_by: :solver
type: base
Expand All @@ -38,7 +38,7 @@
offers common management tools and technology
certifications across the platform, and
each product is enterprise-class.
display_name: SUSE Linux Enterprise Server 12 SP3
display_name: SUSE Linux Enterprise Server 15 SP2
download_size: 0
eol: 1730332800
flags: []
Expand All @@ -58,7 +58,7 @@
- https://www.suse.com/releasenotes/x86_64/SUSE-SLES/15-SP2/release-notes-sles.rpm
short_name: SLES15-SP2
source: -1
status: :removed
status: :selected
summary: SUSE Linux Enterprise Server 15 SP2
transact_by: :solver
type: base
Expand Down
30 changes: 22 additions & 8 deletions test/update_test.rb
Expand Up @@ -143,7 +143,7 @@ def default_SetDesktopPattern_stubs
Yast::Update.create_backup(name, paths)
end

it "do not store mount prefix in tarball" do
it "does not store mount prefix in tarball" do
name = "test-backup"
paths = ["/path_with_slash"]
expect(Yast::SCR).to receive(:Execute)
Expand Down Expand Up @@ -392,7 +392,7 @@ def default_SetDesktopPattern_stubs
allow(Yast::Mode).to receive(:update).and_return(false)
end

it "do not set compatible vendors at all" do
it "does not set compatible vendors at all" do
expect(Yast::Pkg).to_not receive(:SetAdditionalVendors)
Yast::Update.InitUpdate()
end
Expand All @@ -406,28 +406,42 @@ def default_SetDesktopPattern_stubs
.and_return(true)
end

# context "no product change SLES->SLES" do
# end
context "no product change SLES->SLES" do
before do
all_products_hash = YAML.load_file(File.join(DATA_DIR,
"zypp", "sles_sles.yml"))
all_products = all_products_hash.map { |p| Y2Packager::Resolvable.new(p) }
allow(Yast::Installation).to receive(:installedVersion)
.and_return("nameandversion"=>"SUSE Linux Enterprise Server 15 SP1")
allow(Y2Packager::Resolvable).to receive(:find).with(kind: :product)
.and_return(all_products)
end

it "does not set compatible vendors at all" do
expect(Yast::Pkg).to_not receive(:SetAdditionalVendors)
Yast::Update.InitUpdate()
end
end

context "product change openSUSE->SLES" do
before do
all_products_hash = YAML.load_file(File.join(DATA_DIR,
"zypp","opensuse_sles.yml"))
"zypp", "opensuse_sles.yml"))
all_products = all_products_hash.map { |p| Y2Packager::Resolvable.new(p) }
allow(Yast::Installation).to receive(:installedVersion)
.and_return("nameandversion" => "openSUSE 15.1")
allow(Y2Packager::Resolvable).to receive(:find).with(kind: :product)
.and_return(all_products)
.and_return(all_products)
end

context "no compatile vendors are defined in the control file" do
context "no compatible vendors are defined in the control file" do
before do
allow(Yast::ProductFeatures).to receive(:GetFeature)
.with("software", "upgrade")
.and_return({})
end

it "do not set compatible vendors at all" do
it "does not set compatible vendors at all" do
expect(Yast::Pkg).to_not receive(:SetAdditionalVendors)
Yast::Update.InitUpdate()
end
Expand Down

0 comments on commit 1082c2d

Please sign in to comment.