Skip to content

Commit

Permalink
Unifying network button position.
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Apr 6, 2016
1 parent 93a64f8 commit 11a6bdb
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 10 deletions.
25 changes: 15 additions & 10 deletions src/lib/installation/clients/inst_disks_activate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,20 @@ def main
missing_part
end

@contents = HBox(
HWeight(999, HStretch()),
@contents =
VBox(
network_button,
VStretch(),
*dasd_part,
*zfcp_part,
*fcoe_part,
*(button_with_spacing(:iscsi, _("Configure &iSCSI Disks"))),
button(:network, _("Change Net&work Configuration")),
HSquash(
VBox(
*dasd_part,
*zfcp_part,
*fcoe_part,
*(button_with_spacing(:iscsi, _("Configure &iSCSI Disks")))
)
),
VStretch()
),
HWeight(999, HStretch())
)
)

@disks_changed = false

Expand Down Expand Up @@ -168,6 +169,10 @@ def main

private

def network_button
Right(PushButton(Id(:network), _("Network Configuration...")))
end

def show_base_dialog
Wizard.SetContents(
@caption,
Expand Down
90 changes: 90 additions & 0 deletions test/inst_disks_activate_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env rspec

require_relative "test_helper"
require "installation/clients/inst_disks_activate"

describe Yast::InstDisksActivateClient do
Yast.import "Arch"
Yast.import "Linuxrc"
Yast.import "ProductFeatures"
Yast.import "GetInstArgs"
Yast.import "UI"
Yast.import "Popup"

describe "#main" do
let(:probed_disks) { [] }

before do
allow(Yast::Linuxrc).to receive(:InstallInf).with("WithFCoE").and_return("0")
allow(Yast::UI).to receive(:OpenDialog)
allow(Yast::UI).to receive(:CloseDialog)
allow(Yast::Popup).to receive(:ConfirmAbort).with(:painless).and_return(true)
end

context "when architecture is s390" do
before do
allow(Yast::UI).to receive(:UserInput).and_return(:abort)
allow(Yast::Arch).to receive(:s390).and_return(true)
end

it "detects DASD disks" do
expect(Yast::SCR).to receive(:Read).with(path(".probe.disk"))
.and_return(probed_disks)
allow(Yast::SCR).to receive(:Read).with(path(".probe.storage"))
.and_return(probed_disks)
expect(subject).to receive(:show_base_dialog)

expect(subject.main).to eq(:abort)
end

it "detects zFCP disks" do
allow(Yast::SCR).to receive(:Read).with(path(".probe.disk"))
.and_return(probed_disks)
expect(Yast::SCR).to receive(:Read).with(path(".probe.storage"))
.and_return(probed_disks)
expect(subject).to receive(:show_base_dialog)

expect(subject.main).to eq(:abort)
end

context "when dasd button is clicked" do
before do
allow(Yast::UI).to receive(:UserInput).and_return(:dasd, :abort)
end

it "calls inst_dasd client" do
expect(Yast::WFM).to receive(:call).with("inst_dasd")
expect(subject).to receive(:show_base_dialog).twice

subject.main
end
end

context "when network button is clicked" do
before do
allow(Yast::UI).to receive(:UserInput).and_return(:network, :abort)
end

it "calls inst_lan client" do
expect(Yast::WFM).to receive(:call).with("inst_lan", ["skip_detection" => true])
expect(subject).to receive(:show_base_dialog).twice

subject.main
end
end

context "when abort button is clicked" do
before do
allow(Yast::UI).to receive(:UserInput).and_return(:abort)
end

it "returns :abort" do
expect(subject).to receive(:show_base_dialog).once

expect(subject.main).to eq(:abort)
end
end

end
end
end

0 comments on commit 11a6bdb

Please sign in to comment.