Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <web-client> master : Use the REST for network/interfaces, test it more.
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Fri, 4 Sep 2009 10:39:03 +0200
  • Message-id: <E1MjUR7-0001Pu-8y@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 8a40db9d1fbda8f9993a0b8c4e5ba2d7a620c7ec
Author: Martin Vidner <mvidner@xxxxxxx>
Date: Fri Sep 4 10:39:03 2009 +0200

Use the REST for network/interfaces, test it more.
---
.../network/app/controllers/network_controller.rb | 16 +++++++++-------
.../test/functional/network_controller_test.rb | 9 +++++++++
2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/plugins/network/app/controllers/network_controller.rb
b/plugins/network/app/controllers/network_controller.rb
index acfa187..48f4194 100644
--- a/plugins/network/app/controllers/network_controller.rb
+++ b/plugins/network/app/controllers/network_controller.rb
@@ -26,8 +26,8 @@ class NetworkController < ApplicationController
# GET /network
def index
@iface = "eth0"
- # ifc = load_proxy "org.opensuse.yast.modules.yapi.network.interfaces",
@iface
- # return false unless ifc
+ ifc = load_proxy "org.opensuse.yast.modules.yapi.network.interfaces",
@iface
+ return false unless ifc

hn = load_proxy "org.opensuse.yast.modules.yapi.network.hostname"
return false unless hn
@@ -45,11 +45,13 @@ class NetworkController < ApplicationController
return false
end

- # @conf_mode = ifc. ?
- # @ip, @netmask = ifc.ipaddr.split "/"
- @conf_mode = "fake-dhcp"
- @ip = "fake-ip"
- @netmask = "fake-netmask"
+ @conf_mode = ifc.bootproto
+ if @conf_mode == "static"
+ ipaddr = ifc.ipaddr
+ else
+ ipaddr = "-/-"
+ end
+ @ip, @netmask = ipaddr.split "/"

@name = hn.name
@domain = hn.domain
diff --git a/plugins/network/test/functional/network_controller_test.rb
b/plugins/network/test/functional/network_controller_test.rb
index b4f05b8..2a15cc7 100644
--- a/plugins/network/test/functional/network_controller_test.rb
+++ b/plugins/network/test/functional/network_controller_test.rb
@@ -29,6 +29,7 @@ class NetworkControllerTest < ActionController::TestCase
# stub what the REST is supposed to return
@if_proxy = ProxyN.new
@if_proxy.result = OpenStruct.new("ipaddr" => '10.20.30.42/24')
+ @if_proxy.result = OpenStruct.new("bootproto" => "dhcp")

@hn_proxy = Proxy1.new
@hn_proxy.result = OpenStruct.new("name" => "Arthur, king of the Britons")
@@ -55,4 +56,12 @@ class NetworkControllerTest < ActionController::TestCase
assert_not_nil assigns(:default_route)
end

+ def test_with_dhcp
+ @if_proxy.result = OpenStruct.new("bootproto" => "dhcp")
+ get :index
+ assert_response :success
+ # test just the last assignment, for brevity
+ assert_not_nil assigns(:default_route)
+ end
+
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages