Project

General

Profile

« Previous | Next » 

Revision 1db7e820

Added by Joseph Magen almost 10 years ago

fixes #5826 - Using dots in kickstart template names or hostgroups causes routing errors

View differences:

config/routes.rb
end
end
constraints(:hostgroup => /[^\/]+/) do
match 'unattended/template/:id/:hostgroup', :to => "unattended#template"
end
end
resources :settings, :only => [:index, :update] do
......
end
end
match 'unattended/template/:id/:hostgroup', :to => "unattended#template"
end
root :to => 'dashboard#index'
test/functional/unattended_controller_test.rb
assert_response :conflict
end
test "template with hostgroup should be rendered" do
test "template with hostgroup should be rendered" do
get :template, {:id => "MyString", :hostgroup => "Common"}
assert_response :success
end
test "template with hostgroup should be rendered even if both have periods in their names" do
config_templates(:mystring).update_attributes(:name => 'My.String')
hostgroups(:common).update_attributes(:name => 'Com.mon')
assert_routing '/unattended/template/My.String/Com.mon', {:controller => 'unattended', :action => 'template', :id => "My.String", :hostgroup => "Com.mon"}
get :template, {:id => "My.String", :hostgroup => "Com.mon"}
assert_response :success
end
test "template with non-existant hostgroup should not be rendered" do
get :template, {:id => "MyString2", :hostgroup => "NotArealHostgroup"}
assert_response :not_found

Also available in: Unified diff