forked from yast/yast-installation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremote_finish_test.rb
executable file
·64 lines (51 loc) · 1.59 KB
/
remote_finish_test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env rspec
require_relative "./test_helper"
require "installation/remote_finish_client"
module Yast
import "WFM"
import "Linuxrc"
describe ::Installation::RemoteFinishClient do
let(:remote) { Y2Remote::Remote.instance }
subject { ::Installation::RemoteFinishClient.new }
describe "#run" do
it "can be called as a WFM client with 'Info'" do
allow(Linuxrc).to receive(:vnc)
result = Yast::WFM.CallFunction("remote_finish", ["Info"])
expect(result).to be_a(Hash)
expect(result["steps"]).to eq(1)
end
it "can be called as a WFM client with 'Write'" do
expect_any_instance_of(::Installation::RemoteFinishClient).to receive(:enable_remote)
expect(Yast::WFM.CallFunction("remote_finish", ["Write"])).to be_nil
end
end
describe "#modes" do
let(:modes) do
subject.modes
end
context "using VNC" do
before do
allow(Linuxrc).to receive(:vnc).and_return true
end
it "configures remote access for installation and autoinst" do
expect(modes.sort).to eq([:autoinst, :installation])
end
end
context "not using VNC " do
before do
allow(Linuxrc).to receive(:vnc).and_return false
end
it "does not configure remote access" do
expect(modes).to be_empty
end
end
end
describe "#enable_remote" do
it "enables remote access" do
expect(remote).to receive(:enable!)
expect(remote).to receive(:write)
subject.enable_remote
end
end
end
end