Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env rspec | ||
|
||
require_relative "test_helper" | ||
|
||
require "yast" | ||
|
||
Yast.import "LanItems" | ||
|
||
include Yast::UIShortcuts | ||
include Yast::I18n | ||
|
||
describe "LanItemsClass#BuildLanOverview" do | ||
let(:unknown_device_overview) { ["<ul><li><p>Unknown Network Device<br>Not configured yet.</p></li></ul>", []] } | ||
let(:wlan_items) { | ||
{ | ||
0 => { | ||
"ifcfg" => "wlan0" | ||
} | ||
} | ||
} | ||
let(:wlan_ifcfg) { | ||
{ | ||
"BOOTPROTO" => "none", | ||
"NAME" => "WiFi Link 6000 Series", | ||
"WIRELESS_AUTH_MODE" => "open", | ||
"WIRELESS_KEY_0" => "" | ||
} | ||
} | ||
|
||
# targeted mainly against bnc#906694 | ||
it "returns translated network device textual description for wlan device" do | ||
allow(Yast::LanItems) | ||
.to receive(:Items) | ||
.and_return(wlan_items) | ||
allow(Yast::LanItems) | ||
.to receive(:GetDeviceMap) | ||
.and_return(wlan_ifcfg) | ||
allow(Yast::NetworkInterfaces) | ||
.to receive(:Current) | ||
.and_return(wlan_ifcfg) | ||
allow(FastGettext) | ||
.to receive(:locale) | ||
.and_return("de") | ||
|
||
# hack locale search path | ||
Yast::I18n::LOCALE_DIR = File.expand_path("../locale", __FILE__) | ||
|
||
textdomain("network") | ||
|
||
# other checks depends on this | ||
# - output of BuildLanOverview changes according number of devices | ||
# even for "failing" (unknown devices) path | ||
expect(Yast::LanItems.Items.size).to eql 1 | ||
|
||
overview = Yast::LanItems.BuildLanOverview | ||
expect(overview).not_to eql unknown_device_overview | ||
end | ||
end |
Binary file not shown.