From 35c737f74bdfbcefdd371f2f46112d323ef77461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Imobach=20Gonz=C3=A1lez=20Sosa?= Date: Tue, 26 Jan 2016 14:42:11 +0000 Subject: [PATCH] Minor fixes to old getHostid test --- test/AutoInstallRules_test.rb | 15 +++++++++++---- .../network/{wicked_output => wicked_partial.out} | 0 2 files changed, 11 insertions(+), 4 deletions(-) rename test/fixtures/network/{wicked_output => wicked_partial.out} (100%) diff --git a/test/AutoInstallRules_test.rb b/test/AutoInstallRules_test.rb index fd140ab8b..cac835900 100755 --- a/test/AutoInstallRules_test.rb +++ b/test/AutoInstallRules_test.rb @@ -112,10 +112,15 @@ end end - describe "#Host ID" do - let(:wicked_output_path) { File.join(root_path, 'test', 'fixtures', 'network', 'wicked_output') } + describe "#getHostid" do + let(:wicked_output_path) do + File.join(root_path, "test", "fixtures", "network", "wicked_partial.out") + end + it "returns host IP in hex format (initial Stage)" do - expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src").and_return({"stdout"=>File.read(wicked_output_path), "exit"=>0}) + expect(Yast::SCR).to receive(:Execute). + with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src"). + and_return("stdout" => File.read(wicked_output_path), "exit" => 0) expect(Yast::Stage).to receive(:initial).and_return(true) expect(subject.getHostid).to eq("C0A864DA") @@ -129,7 +134,9 @@ it "returns nil if wicked does not find IP address" do expect(Yast::Stage).to receive(:initial).and_return(true) - expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src").and_return({"stderr"=>"error from wicked", "exit"=>1}) + expect(Yast::SCR).to receive(:Execute). + with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src"). + and_return("stderr" => "error from wicked", "exit" => 1) expect(subject.getHostid).to eq(nil) end diff --git a/test/fixtures/network/wicked_output b/test/fixtures/network/wicked_partial.out similarity index 100% rename from test/fixtures/network/wicked_output rename to test/fixtures/network/wicked_partial.out