Mailinglist Archive: yast-commit (1914 mails)

< Previous Next >
[yast-commit] <web-client> master : add tests for webclient basesystem
  • From: Martin Kudlvasr <mkudlvasr@xxxxxxx>
  • Date: Thu, 10 Sep 2009 16:52:37 +0200
  • Message-id: <E1Mll1i-0003mx-Ax@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 0b5db6a53605a2b8e78db0d1fa2809c01b73d10d
Author: Martin Kudlvasr <mkudlvasr@xxxxxxx>
Date: Thu Sep 10 16:52:37 2009 +0200

add tests for webclient basesystem
---
.../test/functional/basesystem_controller_test.rb | 91 ++++++++++++++++++++
1 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/webclient/test/functional/basesystem_controller_test.rb
b/webclient/test/functional/basesystem_controller_test.rb
new file mode 100644
index 0000000..67dc411
--- /dev/null
+++ b/webclient/test/functional/basesystem_controller_test.rb
@@ -0,0 +1,91 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+require 'mocha'
+
+class BasesystemControllerTest < ActionController::TestCase
+
+ class Proxy
+ attr_accessor :result, :permissions, :timeout
+
+ def initialize (result, permissions)
+ @result = result
+ @permissions = permissions
+ end
+
+ def find
+ return @result
+ end
+ end
+
+ class Result
+ attr_accessor :steps, :finish, :saved
+
+ def initialize (steps, finish)
+ @steps = steps
+ @finish = finish
+ @saved = false
+ end
+
+ def save
+ @saved = true
+ end
+ end
+
+ class Step
+ attr_accessor :controller, :action
+
+ def initialize (controller, action = nil)
+ @controller = controller
+ @action = action
+ end
+ end
+
+
+ def setup
+ ControlpanelController.any_instance.stubs(:ensure_login)
+ @controller = ControlpanelController.new
+ #@request = ActionController::TestRequest.new
+ # http://railsforum.com/viewtopic.php?id=1719
+ #@request.session[:account_id] = 1 # defined in fixtures
+
+ # setup for basesystem tests
+ @result = Result.new([Step.new("systemtime"), Step.new("language",
"show")], true)
+ @proxy = Proxy.new(@result, {:read=>true, :write=>true})
+
YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.basesystem').returns(@proxy)
+ end
+
+ test "basesystem start" do
+ @result.finish = false
+ get :index
+ assert_redirected_to :action => :basesystem
+ assert_not_nil session[:wizard_current]
+ assert_not_nil session[:wizard_steps]
+ get :basesystem
+ assert_response :success
+ end
+
+ test "basesystem thisstep" do
+ @result.finish = false
+ get :index
+ get :thisstep
+ assert_response :redirect
+ assert_redirected_to "/systemtime"
+ end
+
+ test "basesystem next" do
+ @result.finish = false
+ get :index
+ get :nextstep
+ assert_response :redirect
+ assert_redirected_to "/language/show"
+ end
+
+ test "basesystem finish" do
+ @result.finish = false
+ get :index
+ get :nextstep
+ get :nextstep
+ assert @result.finish
+ assert @result.saved
+ 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