Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <rest-service> master : Cleanup and full test coverage
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Tue, 7 Jul 2009 16:05:02 +0200
  • Message-id: <E1MOBIB-0002d8-Ta@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 8791a149f88bcd1b6615e7a540c277075477c45c
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Tue Jul 7 16:05:02 2009 +0200

Cleanup and full test coverage
---
webservice/app/controllers/resources_controller.rb | 15 ++++++---------
.../test/functional/resources_controller_test.rb | 9 +++++++--
2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/webservice/app/controllers/resources_controller.rb
b/webservice/app/controllers/resources_controller.rb
index 1ba6e05..d419eb0 100644
--- a/webservice/app/controllers/resources_controller.rb
+++ b/webservice/app/controllers/resources_controller.rb
@@ -2,18 +2,15 @@ class ResourcesController < ApplicationController
require "resource_registration"

def index
- if params[:interface]
- @resources = Hash.new
- @resources[params[:interface]] =
ResourceRegistration.resources[params[:interface]]
+ iface = params[:interface]
+ if iface
+ # return single resource if specific interface requested
+ rsrc = ResourceRegistration.resources[iface]
+ @resources = rsrc ? { iface => rsrc } : Hash.new
else
+ # return all known resources
@resources = ResourceRegistration.resources
end
@node = "Yast"
- # respond_to do |format|
- # format.html { ... }
- # format.xml { ... }
- # end
- #
- # -> index.erb.<format>
end
end
diff --git a/webservice/test/functional/resources_controller_test.rb
b/webservice/test/functional/resources_controller_test.rb
index b341c75..3b652af 100644
--- a/webservice/test/functional/resources_controller_test.rb
+++ b/webservice/test/functional/resources_controller_test.rb
@@ -14,8 +14,8 @@ end

class ResourcesControllerTest < ActionController::TestCase

- require "lib/resource_registration"
-
+ require File.expand_path(File.dirname(__FILE__) +
"/../../lib/resource_registration")
+
def setup
# set up test routing
ResourceRegistration.reset
@@ -28,6 +28,11 @@ class ResourcesControllerTest < ActionController::TestCase
assert_response :success
end

+ test "resources index with interface" do
+ get :index, :interface => "org.opensuse.test"
+ assert_response :success
+ end
+
test "resources output xml format" do
get :index, :format => "xml"
assert_response :success
--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages