Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable autorefresh for local repositories (bsc#948982)
- Loading branch information
Showing
3 changed files
with
65 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--color --format doc |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#! /usr/bin/env rspec | ||
|
||
require_relative "./test_helper" | ||
|
||
# just a wrapper class for the repositories_include.rb | ||
class RepositoryIncludeTester | ||
extend Yast::I18n | ||
Yast.include self, "packager/repositories_include.rb" | ||
end | ||
|
||
describe RepositoryIncludeTester do | ||
describe ".autorefresh" do | ||
# local protocols | ||
[ "cd", "dvd", "dir", "hd", "iso", "file" ].each do |protocol| | ||
url = "#{protocol}://foo/bar" | ||
it "returns false for local '#{url}' URL" do | ||
expect(described_class.autorefresh(url)).to eq(false) | ||
end | ||
end | ||
|
||
# remote protocols | ||
# see https://github.com/openSUSE/libzypp/blob/master/zypp/Url.cc#L464 | ||
[ "http", "https", "nfs", "nfs4", "smb", "cifs", "ftp", "sftp", "tftp" ].each do |protocol| | ||
url = "#{protocol}://foo/bar" | ||
it "returns true for remote '#{url}' URL" do | ||
expect(described_class.autorefresh(url)).to eq(true) | ||
end | ||
end | ||
|
||
it "handles uppercase URLs correctly" do | ||
expect(described_class.autorefresh("FTP://FOO/BAR")).to eq(true) | ||
expect(described_class.autorefresh("DVD://FOO/BAR")).to eq(false) | ||
end | ||
end | ||
end |