Skip to content

Commit

Permalink
Merge pull request #1099 from yast/merge-sle-15-sp2
Browse files Browse the repository at this point in the history
Merge SLE-15-SP2 into master
  • Loading branch information
imobachgs committed Sep 1, 2020
2 parents 22b0f5c + dd01c52 commit 1e334a7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/lan_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,15 @@
end
end

describe "#readIPv6" do
describe "#writeIPv6" do
let(:sysctl_config_file) { CFA::SysctlConfig.new }

before do
allow(CFA::SysctlConfig).to receive(:new).and_return(sysctl_config_file)
allow(sysctl_config_file).to receive(:load)
allow(sysctl_config_file).to receive(:save)
allow(Yast::SCR).to receive(:Write)
.with(path(".sysconfig.windowmanager.KDE_USE_IPV6"), String)
Yast::Lan.ipv6 = ipv6
end

Expand All @@ -280,27 +282,41 @@

it "enables IPv6 in the sysctl_config configuration" do
expect(sysctl_config_file).to receive(:disable_ipv6=).with(false)
expect(sysctl_config_file).to receive(:save)
Yast::Lan.writeIPv6
end

it "enables IPv6 in the running system" do
expect(Yast::SCR).to receive(:Execute).with(anything, /sysctl .+disable_ipv6=0/)
Yast::Lan.writeIPv6
end

it "enables IPv6 for KDE" do
expect(Yast::SCR).to receive(:Write)
.with(path(".sysconfig.windowmanager.KDE_USE_IPV6"), "yes")
subject.writeIPv6
end
end

context "when IPv6 is disabled" do
let(:ipv6) { false }

it "disables IPv6 in the sysctl_config configuration" do
expect(sysctl_config_file).to receive(:disable_ipv6=).with(true)
expect(sysctl_config_file).to receive(:save)
Yast::Lan.writeIPv6
end

it "disables IPv6 in the running system" do
expect(Yast::SCR).to receive(:Execute).with(anything, /sysctl .+disable_ipv6=1/)
Yast::Lan.writeIPv6
end

it "disables IPv6 for KDE" do
expect(Yast::SCR).to receive(:Write)
.with(path(".sysconfig.windowmanager.KDE_USE_IPV6"), "no")
subject.writeIPv6
end
end
end

Expand Down

0 comments on commit 1e334a7

Please sign in to comment.