Mailinglist Archive: yast-commit (2114 mails)

< Previous Next >
[yast-commit] <rest-service> master : Fixed failing test cases (sic) after the last interface change.
  • From: Martin Vidner <mvidner@xxxxxxx>
  • Date: Tue, 15 Sep 2009 14:31:03 +0200
  • Message-id: <E1Mo1uX-0001vu-0D@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 19dc2a682fff685763dfdb47859a72e577ed1a8d
Author: Martin Vidner <mvidner@xxxxxxx>
Date: Tue Sep 15 13:00:05 2009 +0200

Fixed failing test cases (sic) after the last interface change.

(in c6a173)
Use correct keys in mock.
Do not access root until after we have checked it for nil, duh.
---
.../app/controllers/network/dns_controller.rb | 6 +++---
.../network/test/functional/dns_controller_test.rb | 8 +++++++-
2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/plugins/network/app/controllers/network/dns_controller.rb
b/plugins/network/app/controllers/network/dns_controller.rb
index 41fbf89..810b7df 100644
--- a/plugins/network/app/controllers/network/dns_controller.rb
+++ b/plugins/network/app/controllers/network/dns_controller.rb
@@ -10,13 +10,13 @@ class Network::DnsController < ApplicationController
# Sets hostname settings. Requires write permissions for network YaPI.
def update
root = params[:dns]
- root["searches"]=root["searches"].split
- root["nameservers"]=root["nameservers"].split
-
if root == nil
render ErrorResult.error(404, 2, "format or internal error") and return
end

+ root["searches"]=root["searches"].split
+ root["nameservers"]=root["nameservers"].split
+
@dns = DNS.new(root)
@dns.save
respond_to do |format|
diff --git a/plugins/network/test/functional/dns_controller_test.rb
b/plugins/network/test/functional/dns_controller_test.rb
index 8217bf7..a26a1e6 100644
--- a/plugins/network/test/functional/dns_controller_test.rb
+++ b/plugins/network/test/functional/dns_controller_test.rb
@@ -9,7 +9,13 @@ class DnsControllerTest < ActionController::TestCase

def setup
@model_class = DNS
- DNS.stubs(:find).returns(DNS.new({"dnsdomains" => ["d1", "d2"],
"dnsservers" => ["s1", "s2"]}))
+ # FIXME: bad mock for DNS (field name mismatch):
+ # DNS.stubs(:find).returns(DNS.new({"BAD" => ["d1", "d2"], "KEYS"=> ["s1",
"s2"]}))
+
+ # in test_access_show_xml:
+ # add assert_response :success)
+ # in case of error: give a nicer error than 500
+ DNS.stubs(:find).returns(DNS.new({"searches" => ["d1", "d2"],
"nameservers" => ["s1", "s2"]}))
@controller = Network::DnsController.new
@request = ActionController::TestRequest.new
# http://railsforum.com/viewtopic.php?id=1719
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages