[yast-commit] <web-client> master : first working version of status tests
ref: refs/heads/master commit 03f5e70674f23685a8a205614df598b0448b0953 Author: Josef Reidinger <jreidinger@suse.cz> Date: Thu Nov 26 15:44:28 2009 +0100 first working version of status tests --- .../test/functional/status_controller_test.rb | 52 +++++++++++++++++++- 1 files changed, 50 insertions(+), 2 deletions(-) diff --git a/plugins/status/test/functional/status_controller_test.rb b/plugins/status/test/functional/status_controller_test.rb index 5de00c1..0667737 100644 --- a/plugins/status/test/functional/status_controller_test.rb +++ b/plugins/status/test/functional/status_controller_test.rb @@ -3,6 +3,21 @@ require 'test/unit' require File.expand_path( File.join("test","validation_assert"), RailsParent.parent ) require 'mocha' +#extra ugly hack for dynamic created type +module YaST + module ServiceResource + module Proxies + module Status + module Metric + module Label + end + end + end + end + end +end + + class StatusControllerTest < ActionController::TestCase class Log @@ -21,18 +36,51 @@ DEFINED_LOGS = [ class StatusProxy attr_accessor :result, :permissions, :timeout - def find(arg=nil) - return {} + def initialize + @permissions = { :read => true, :write => :true} + end + def find(arg=nil,arg2=nil) + return StatusMock.new end end class LogsProxy attr_accessor :result, :permissions, :timeout + def initialize + @permissions = { :read => true, :write => :true} + end def find(arg) return @result end end +class MetricMock + attr_accessor :name, :metricgroup, :interval, :starttime + def initialize (n,m,i,s) + @name = n + @metricgroup = m + @interval = i + @starttime = s + end + + def attributes + { "label" => ""} + end +end + +ATTR_DATA = { + "metric" => [ + MetricMock.new("test","tg",5,Time.now()) + ], + "label" => "" #hach to avoid creating horrible mockup +} + + class StatusMock + def attributes + ATTR_DATA + end + end + def setup StatusController.any_instance.stubs(:login_required) @controller = StatusController.new -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
Josef Reidinger