Skip to content

Commit

Permalink
replace old testsuite for read
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Feb 5, 2020
1 parent 4999c8f commit dd94565
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 61 deletions.
43 changes: 43 additions & 0 deletions timezone/test/Timezone_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -481,4 +481,47 @@
end
end
end

describe "#Read" do
before do
allow(Yast::SCR).to receive(:Read)
end

it "reads default_timezone from /etc/localtime symlink" do
allow(Yast::FileUtils).to receive(:IsLink).and_return true
expect(Yast::SCR).to receive(:Read).with(path(".target.symlink"), "/etc/localtime")
.and_return("/usr/share/zoneinfo/Europe/Prague")

subject.Read

expect(subject.timezone).to eq "Europe/Prague"
end

it "reads default_timezone from sysconfig if /etc/localtime is not link" do
expect(Yast::SCR).to receive(:Read).with(path(".sysconfig.clock.DEFAULT_TIMEZONE"))
.and_return("Europe/Prague")

subject.Read
end

it "sets hwclock according to /etc/adjtime if exists" do
expect(subject).to receive(:ReadAdjTime).and_return(["", "", "LOCAL"])

subject.Read

expect(subject.hwclock).to eq "--localtime"
end

it "reads hwclock sysconfig if /etc/adjtime does not exist" do
expect(subject).to receive(:ReadAdjTime).and_return(nil)
expect(Yast::SCR).to receive(:Read).with(path(".sysconfig.clock.HWCLOCK"))
.and_return("--localtime")

subject.Read

expect(subject.hwclock).to eq "--localtime"
end

# TODO: mode config specific functionality
end
end
Empty file.
6 changes: 0 additions & 6 deletions timezone/testsuite/tests/ReadExport.out

This file was deleted.

55 changes: 0 additions & 55 deletions timezone/testsuite/tests/ReadExport.rb

This file was deleted.

0 comments on commit dd94565

Please sign in to comment.