ref: refs/heads/basesystem
commit 83e1d5f0ff3c47bd9c9b5e39eb6b5ffdf3391594
Author: Ladislav Slezak
Date: Mon Aug 31 09:56:20 2009 +0200
test partial result, remove trailing CR char
---
plugins/services/app/views/services/_status.rhtml | 2 +-
.../test/functional/services_controller_test.rb | 30 ++++++++++++++++++--
2 files changed, 28 insertions(+), 4 deletions(-)
diff --git a/plugins/services/app/views/services/_status.rhtml b/plugins/services/app/views/services/_status.rhtml
index e8e5569..874c4e1 100644
--- a/plugins/services/app/views/services/_status.rhtml
+++ b/plugins/services/app/views/services/_status.rhtml
@@ -21,4 +21,4 @@ case status
else
_("(unknown: #{status})")
end
-%>
+-%>
diff --git a/plugins/services/test/functional/services_controller_test.rb b/plugins/services/test/functional/services_controller_test.rb
index a43049e..07870ca 100644
--- a/plugins/services/test/functional/services_controller_test.rb
+++ b/plugins/services/test/functional/services_controller_test.rb
@@ -2,31 +2,55 @@ require 'test_helper'
class ServicesControllerTest < ActionController::TestCase
-
class Proxy
attr_accessor :result, :permissions, :timeout
- def find
+ def find(params = {})
return result
end
end
+ class Result
+ attr_accessor :status
+
+ def fill
+ @status = 0
+ end
+
+ def save
+ return true
+ end
+ end
+
def setup
+ @result = Result.new
+ @result.fill
+
ServicesController.any_instance.stubs(:login_required)
@controller = ServicesController.new
+
@request = ActionController::TestRequest.new
# http://railsforum.com/viewtopic.php?id=1719
@request.session[:account_id] = 1 # defined in fixtures
+
@permissions = { :read => true, :execute => true }
@proxy = Proxy.new
@proxy.permissions = @permissions
@proxy.result = @result
+
+ YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.services').returns(@proxy)
end
def test_should_get_index
- YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.yapi.services').returns(@proxy)
get :index
assert_response :success
assert_not_nil assigns(:services)
end
+
+ def test_ntp_status
+ ret = get :show_status, {:id => 'ntp'}
+ assert_response :success
+ assert ret.body == '(running)'
+ end
+
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org