ref: refs/heads/dmacvicar_log_viewer
commit 075e02284fbde63b2bc2ca404d4e5184bf8d8bd4
Author: Martin Vidner
Date: Fri Sep 4 09:56:07 2009 +0200
Added a DnsController test, including XML contents.
---
.../network/test/functional/dns_controller_test.rb | 29 ++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/plugins/network/test/functional/dns_controller_test.rb b/plugins/network/test/functional/dns_controller_test.rb
new file mode 100644
index 0000000..8217bf7
--- /dev/null
+++ b/plugins/network/test/functional/dns_controller_test.rb
@@ -0,0 +1,29 @@
+require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
+require 'test/unit'
+#require 'dns'
+require 'rubygems'
+require 'mocha'
+require File.expand_path( File.join("test","plugin_basic_tests"), RailsParent.parent )
+
+class DnsControllerTest < ActionController::TestCase
+
+ def setup
+ @model_class = DNS
+ DNS.stubs(:find).returns(DNS.new({"dnsdomains" => ["d1", "d2"], "dnsservers" => ["s1", "s2"]}))
+ @controller = Network::DnsController.new
+ @request = ActionController::TestRequest.new
+ # http://railsforum.com/viewtopic.php?id=1719
+ @request.session[:account_id] = 1 # defined in fixtures
+ end
+
+ def test_content_of_xml
+ get :show, :format => 'xml'
+ h = Hash.from_xml @response.body
+ assert_instance_of Array, h['dns']['nameservers']
+ assert_instance_of Array, h['dns']['searches']
+ end
+
+ include PluginBasicTests
+
+end
+
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org