-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Converted legacy testsuite/ to RSpec.
- Loading branch information
Showing
8 changed files
with
66 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
TESTS = \ | ||
read_test.rb \ | ||
test_proxy_return_code_test.rb \ | ||
write_test.rb | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env rspec | ||
require_relative "test_helper" | ||
require "yast" | ||
|
||
Yast.import "Proxy" | ||
|
||
describe "Yast::ProxyClass" do | ||
subject do | ||
Yast::Proxy | ||
end | ||
|
||
context "common Read-Export test" do | ||
before do | ||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".sysconfig.proxy.HTTP_PROXY")). | ||
and_return "h" | ||
|
||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".sysconfig.proxy.HTTPS_PROXY")). | ||
and_return "hs" | ||
|
||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".sysconfig.proxy.FTP_PROXY")). | ||
and_return "f" | ||
|
||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".sysconfig.proxy.NO_PROXY")). | ||
and_return nil | ||
|
||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".sysconfig.proxy.PROXY_ENABLED")). | ||
and_return nil | ||
|
||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".target.size"), "/root/.curlrc"). | ||
and_return 42 | ||
|
||
expect(Yast::SCR).to receive(:Read). | ||
with(path(".root.curlrc.\"--proxy-user\"")). | ||
and_return "user:pass" | ||
end | ||
|
||
describe "#Read" do | ||
it "reads /etc/sysconfig/proxy and /root/.curlrc via SCR" do | ||
expect(subject.Read).to be true | ||
end | ||
end | ||
|
||
describe "#Export" do | ||
it "returns an appropriate hash" do | ||
subject.Read | ||
expect(subject.Export).to eq({ | ||
"enabled" => true, | ||
"ftp_proxy" => "f", | ||
"http_proxy" => "h", | ||
"https_proxy" => "hs", | ||
"no_proxy" => "", | ||
"proxy_password" => "pass", | ||
"proxy_user" => "user" | ||
}) | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.