[yast-commit] <web-client> master : adding testcase for bnc#557176
ref: refs/heads/master commit 06c2350ee6728033718859ab43d826fe02866c8e Author: J. Daniel Schmidt <jdsn@suse.de> Date: Thu Nov 26 13:35:52 2009 +0100 adding testcase for bnc#557176 --- .../app/controllers/registration_controller.rb | 6 ++-- .../app/views/registration/index.rhtml | 2 +- .../functional/registration_controller_test.rb | 21 +++++++++++++++++++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/plugins/registration/app/controllers/registration_controller.rb b/plugins/registration/app/controllers/registration_controller.rb index d5979b3..407ef36 100644 --- a/plugins/registration/app/controllers/registration_controller.rb +++ b/plugins/registration/app/controllers/registration_controller.rb @@ -36,14 +36,14 @@ class RegistrationController < ApplicationController def translate_argument_key(key) return '-unknown-' unless key - return @trans[key] if @trans[key] + return @trans[key] if ( @trans.kind_of?(Hash) && @trans[key] ) key end def sort_arguments(args) - return Array.new unless args + return Array.new unless args.kind_of?(Array) args.collect! do |arg| - arg['description'] = translate_argument_key( arg['name'] ) + arg['description'] = translate_argument_key( arg.kind_of?(Hash) ? arg['name'] : nil ) arg end args.sort! { |a,b| a['name'] <=> b['name'] } diff --git a/plugins/registration/app/views/registration/index.rhtml b/plugins/registration/app/views/registration/index.rhtml index 0f45c63..290b610 100644 --- a/plugins/registration/app/views/registration/index.rhtml +++ b/plugins/registration/app/views/registration/index.rhtml @@ -23,7 +23,7 @@ <% if argument["flag"] == "m" || @detail then %> <p> <label for="<%= 'registration_arg_'+argument['name'] %>" <%= argument["error"] ? 'style="color: red"' : '' %> > - <%=_(argument['description'])%> + <%= argument['description'] %> </label> <%= text_field_tag "registration_arg,"+argument["name"], argument["value"] %> </p> diff --git a/plugins/registration/test/functional/registration_controller_test.rb b/plugins/registration/test/functional/registration_controller_test.rb index 2ca0569..85590f2 100644 --- a/plugins/registration/test/functional/registration_controller_test.rb +++ b/plugins/registration/test/functional/registration_controller_test.rb @@ -29,14 +29,22 @@ class RegistrationControllerTest < ActionController::TestCase def fill @status = 'missinginfo' - @exitcode = 0, + @exitcode = 4, @missingarguments =[{'name'=>'Email', 'type'=>'string'}, {'name'=>'Registration Name', 'type'=>'string'}, {'name'=>'System Name', 'type'=>'string'}] end + + def fill_false + @status = 'missinginfo' + @exitcode = 4, + @missingarguments = [nil, nil] + end + def save @saved = true end + def to_xml "xml output" end @@ -98,4 +106,15 @@ class RegistrationControllerTest < ActionController::TestCase assert_response :redirect assert_redirected_to :controller => "controlpanel", :action => "nextstep" end + + def test_register_with_false_arguments + @proxy.result.fill_false + YaST::ServiceResource.stubs(:proxy_for).with('org.opensuse.yast.modules.registration.registration').returns(@proxy) + + get :index + + assert_response :success + assert_valid_markup + end + end -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
J.Daniel Schmidt