Mailinglist Archive: yast-commit (883 mails)

< Previous Next >
[yast-commit] <rest-service> master : Unify naming
  • From: Klaus Kämpf <kkaempf@xxxxxxx>
  • Date: Tue, 7 Jul 2009 14:12:55 +0200
  • Message-id: <E1MO9Xh-0000pF-96@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit da3e86d3eef735722696cb305d34fe9a690b3444
Author: Klaus Kämpf <kkaempf@xxxxxxx>
Date: Tue Jul 7 14:12:55 2009 +0200

Unify naming
---
.../test/functional/resource_registration_test.rb | 114 --------------------
webservice/test/functional/resource_route_test.rb | 49 ---------
.../test/functional/resources_registration_test.rb | 114 ++++++++++++++++++++
webservice/test/functional/resources_route_test.rb | 49 +++++++++
4 files changed, 163 insertions(+), 163 deletions(-)

diff --git a/webservice/test/functional/resource_registration_test.rb
b/webservice/test/functional/resource_registration_test.rb
deleted file mode 100644
index 2144884..0000000
--- a/webservice/test/functional/resource_registration_test.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-#
-# test/functional/resource_registration_test.rb
-#
-# This tests the mapping from resource descriptions (yaml files) to the
database
-#
-# See resource_route_test.rb for resource route tests.
-#
-require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
-
-class TestPlugin
- attr_reader :directory
- def initialize path
- @directory = path
- end
-end
-
-class ResourceRegistrationTest < ActiveSupport::TestCase
-
- require "lib/resource_registration"
-
- # Create resources from .yml file
-
- test "resource creation" do
- plugin = TestPlugin.new "test/resource_fixtures/good"
- ResourceRegistration.register_plugin plugin
-
- assert !ResourceRegistration.resources.empty?
- end
-
- # Catch errors in interface
-
- test "bad interface" do
- plugin = TestPlugin.new "test/resource_fixtures/bad_interface"
- assert_raise RuntimeError do
- ResourceRegistration.register_plugin plugin
- end
- end
-
- test "no interface" do
- plugin = TestPlugin.new "test/resource_fixtures/no_interface"
- assert_raise RuntimeError do
- ResourceRegistration.register_plugin plugin
- end
- end
-
- # Catch errors in controller
-
- test "no controller" do
- plugin = TestPlugin.new "test/resource_fixtures/no_controller"
- assert_raise RuntimeError do
- ResourceRegistration.register_plugin plugin
- end
- end
-
- test "bad controller, go fix web-client to use modules" do
- plugin = TestPlugin.new "test/resource_fixtures/bad_controller"
-# assert_raise RuntimeError do
- ResourceRegistration.register_plugin plugin
-# end
- end
-
- # Catch pluralization error
-
- test "interface is singular but not flagged as such" do
- plugin = TestPlugin.new "test/resource_fixtures/bad_singular"
- assert_raise RuntimeError do
- ResourceRegistration.register_plugin plugin
- end
- end
-
- # Pass bad values to register_plugin
-
- test "pass bad values to register_plugin" do
- assert_raise NoMethodError do
- ResourceRegistration.register_plugin nil
- end
- assert_raise NoMethodError do
- ResourceRegistration.register_plugin 1
- end
- assert_raise NoMethodError do
- ResourceRegistration.register_plugin true
- end
- end
-
- # Catch non-existing file
-
- test "file does not exist" do
- assert_raise Errno::ENOENT do
- ResourceRegistration.register "does_not_exist"
- end
- end
-
- # Bad call to register
-
- test "passing bad values to register" do
- assert_raise TypeError do
- ResourceRegistration.register nil
- end
- assert_raise TypeError do
- ResourceRegistration.register 1
- end
- assert_raise TypeError do
- ResourceRegistration.register true
- end
- end
-
- # Complain about private routing
-
- test "complain about private routing" do
- plugin = TestPlugin.new "test/resource_fixtures/private_routing"
- assert ResourceRegistration.register_plugin plugin
- end
-
-end
diff --git a/webservice/test/functional/resource_route_test.rb
b/webservice/test/functional/resource_route_test.rb
deleted file mode 100644
index c373e15..0000000
--- a/webservice/test/functional/resource_route_test.rb
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-# test/functional/resource_route_test.rb
-#
-# This tests route creation from the resource database
-#
-require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
-
-class TestPlugin
- attr_reader :directory
- def initialize path
- @directory = path
- end
-end
-
-class ResourceRouteTest < ActiveSupport::TestCase
-
- # See http://pennysmalls.com/2009/03/04/rails-23-breakage-and-fixage/
- include ActionController::Assertions::RoutingAssertions
-
- require "lib/resource_registration"
-
- # config/initializers/resource_registration.rb sets it up
-
- test "resource route initialization" do
-
- plugin = TestPlugin.new "test/resource_fixtures/good"
- ResourceRegistration.reset
- ResourceRegistration.register_plugin plugin
-
-# $stderr.puts ActionController::Routing::Routes.routes
-
- # root URI links to ResourcesController.index
- assert_recognizes( { :controller => "resources", :action => "index" }, "/"
)
- # as does /resources
- assert_routing( { :path => "/resources", :method => :get }, { :controller
=> "resources", :action => "index" } )
-
- # Ensure there is a route for every resource
- ResourceRegistration.resources.each do |interface,implementations|
- implementations.each do |implementation|
- if implementation[:singular]
- assert_generates "#{implementation[:controller]}", { :controller =>
"#{implementation[:controller]}", :action => :show }
- else
- assert_generates "#{implementation[:controller]}", { :controller =>
"#{implementation[:controller]}", :action => :index }
- end
- end
- end
- end
-
-end
diff --git a/webservice/test/functional/resources_registration_test.rb
b/webservice/test/functional/resources_registration_test.rb
new file mode 100644
index 0000000..2144884
--- /dev/null
+++ b/webservice/test/functional/resources_registration_test.rb
@@ -0,0 +1,114 @@
+#
+# test/functional/resource_registration_test.rb
+#
+# This tests the mapping from resource descriptions (yaml files) to the
database
+#
+# See resource_route_test.rb for resource route tests.
+#
+require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
+
+class TestPlugin
+ attr_reader :directory
+ def initialize path
+ @directory = path
+ end
+end
+
+class ResourceRegistrationTest < ActiveSupport::TestCase
+
+ require "lib/resource_registration"
+
+ # Create resources from .yml file
+
+ test "resource creation" do
+ plugin = TestPlugin.new "test/resource_fixtures/good"
+ ResourceRegistration.register_plugin plugin
+
+ assert !ResourceRegistration.resources.empty?
+ end
+
+ # Catch errors in interface
+
+ test "bad interface" do
+ plugin = TestPlugin.new "test/resource_fixtures/bad_interface"
+ assert_raise RuntimeError do
+ ResourceRegistration.register_plugin plugin
+ end
+ end
+
+ test "no interface" do
+ plugin = TestPlugin.new "test/resource_fixtures/no_interface"
+ assert_raise RuntimeError do
+ ResourceRegistration.register_plugin plugin
+ end
+ end
+
+ # Catch errors in controller
+
+ test "no controller" do
+ plugin = TestPlugin.new "test/resource_fixtures/no_controller"
+ assert_raise RuntimeError do
+ ResourceRegistration.register_plugin plugin
+ end
+ end
+
+ test "bad controller, go fix web-client to use modules" do
+ plugin = TestPlugin.new "test/resource_fixtures/bad_controller"
+# assert_raise RuntimeError do
+ ResourceRegistration.register_plugin plugin
+# end
+ end
+
+ # Catch pluralization error
+
+ test "interface is singular but not flagged as such" do
+ plugin = TestPlugin.new "test/resource_fixtures/bad_singular"
+ assert_raise RuntimeError do
+ ResourceRegistration.register_plugin plugin
+ end
+ end
+
+ # Pass bad values to register_plugin
+
+ test "pass bad values to register_plugin" do
+ assert_raise NoMethodError do
+ ResourceRegistration.register_plugin nil
+ end
+ assert_raise NoMethodError do
+ ResourceRegistration.register_plugin 1
+ end
+ assert_raise NoMethodError do
+ ResourceRegistration.register_plugin true
+ end
+ end
+
+ # Catch non-existing file
+
+ test "file does not exist" do
+ assert_raise Errno::ENOENT do
+ ResourceRegistration.register "does_not_exist"
+ end
+ end
+
+ # Bad call to register
+
+ test "passing bad values to register" do
+ assert_raise TypeError do
+ ResourceRegistration.register nil
+ end
+ assert_raise TypeError do
+ ResourceRegistration.register 1
+ end
+ assert_raise TypeError do
+ ResourceRegistration.register true
+ end
+ end
+
+ # Complain about private routing
+
+ test "complain about private routing" do
+ plugin = TestPlugin.new "test/resource_fixtures/private_routing"
+ assert ResourceRegistration.register_plugin plugin
+ end
+
+end
diff --git a/webservice/test/functional/resources_route_test.rb
b/webservice/test/functional/resources_route_test.rb
new file mode 100644
index 0000000..c373e15
--- /dev/null
+++ b/webservice/test/functional/resources_route_test.rb
@@ -0,0 +1,49 @@
+#
+# test/functional/resource_route_test.rb
+#
+# This tests route creation from the resource database
+#
+require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
+
+class TestPlugin
+ attr_reader :directory
+ def initialize path
+ @directory = path
+ end
+end
+
+class ResourceRouteTest < ActiveSupport::TestCase
+
+ # See http://pennysmalls.com/2009/03/04/rails-23-breakage-and-fixage/
+ include ActionController::Assertions::RoutingAssertions
+
+ require "lib/resource_registration"
+
+ # config/initializers/resource_registration.rb sets it up
+
+ test "resource route initialization" do
+
+ plugin = TestPlugin.new "test/resource_fixtures/good"
+ ResourceRegistration.reset
+ ResourceRegistration.register_plugin plugin
+
+# $stderr.puts ActionController::Routing::Routes.routes
+
+ # root URI links to ResourcesController.index
+ assert_recognizes( { :controller => "resources", :action => "index" }, "/"
)
+ # as does /resources
+ assert_routing( { :path => "/resources", :method => :get }, { :controller
=> "resources", :action => "index" } )
+
+ # Ensure there is a route for every resource
+ ResourceRegistration.resources.each do |interface,implementations|
+ implementations.each do |implementation|
+ if implementation[:singular]
+ assert_generates "#{implementation[:controller]}", { :controller =>
"#{implementation[:controller]}", :action => :show }
+ else
+ assert_generates "#{implementation[:controller]}", { :controller =>
"#{implementation[:controller]}", :action => :index }
+ end
+ end
+ end
+ 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