From 9d941dd43fd0a89a2dc7cd90ac813205b1908990 Mon Sep 17 00:00:00 2001 From: Ladislav Slezak Date: Fri, 1 Feb 2013 13:21:20 +0100 Subject: [PATCH] removed tests for deleted hosts controller --- .../test/functional/hosts_controller_test.rb | 108 ------------------ .../test/integration/manage_hosts_test.rb | 82 ------------- 2 files changed, 190 deletions(-) delete mode 100644 webclient/test/functional/hosts_controller_test.rb delete mode 100644 webclient/test/integration/manage_hosts_test.rb diff --git a/webclient/test/functional/hosts_controller_test.rb b/webclient/test/functional/hosts_controller_test.rb deleted file mode 100644 index 2ce0e2a6..00000000 --- a/webclient/test/functional/hosts_controller_test.rb +++ /dev/null @@ -1,108 +0,0 @@ -#-- -# Webyast Webservice framework -# -# Copyright (C) 2009, 2010 Novell, Inc. -# This library is free software; you can redistribute it and/or modify -# it only under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -#++ - -require File.dirname(__FILE__) + '/../test_helper' - -class HostsControllerTest < ActionController::TestCase - fixtures :hosts - - def test_should_get_index - get :index - assert_response :success - assert_not_nil assigns(:hosts) - end - - def test_should_get_new - get :new - assert_response :success - end - - def test_should_create_host - assert_difference('Host.count') do - post :create, :host => { :name => "new host", :url => "http://www.rubyonrails.org", :description => "Rails" } - end - - # after creating we redirect to the full list - assert_redirected_to hosts_path - end - - def test_should_fail_create_host - post :create, :host => { } # empty :host hash - - assert_redirected_to new_host_path - end - - def test_should_fail_uri_validation - post :create, :host => { :name => "bad uri", :url => "htx::/foo", :description => "Rails" } - - # after creation failure, ask for re-entering the values - # FIXME -# assert_redirected_to new_host_path - end - - # re-create the first host of the fixture - def test_host_uniqueness - host = Host.find(:first) - assert host - post :create, :host => { :name => host.name, :url => host.url, :description => host.description } - - assert_redirected_to new_host_path - end - - def test_should_show_host - get :show, :id => hosts(:one).id - assert_response :success - end - - def test_should_get_edit - get :edit, :id => hosts(:one).id - assert_response :success - end - - def test_should_update_host - put :update, :id => hosts(:one).id, :host => { :name => "new host", :url => "http://www.rubyonrails.org", :description => "Rails" } - # after creating we redirect to the full list - assert_redirected_to hosts_path - end - - def test_should_fail_update_host - host = hosts(:one) - # this should fail validation (name not unique) - put :update, :id => hosts(:two).id, :host => { :name => host.name, :url => "http://www.rubyonrails.org", :description => "Rails" } - # after creating we redirect to the edit dialog - assert_redirected_to edit_host_path - end - - def test_should_destroy_host - assert_difference('Host.count', -1) do - delete :destroy, :id => hosts(:one).id - end - - assert_redirected_to hosts_path - end - - # check the validate_uri ajax helper - def test_validate_uri_true - get :validate_uri, :host => { :url => "http://www.opensuse.org" } - assert_equal @response.body, "true" - end - def test_validate_uri_false - get :validate_uri, :host => { :url => "htx:/foo" } - assert_equal @response.body, "false" - end -end diff --git a/webclient/test/integration/manage_hosts_test.rb b/webclient/test/integration/manage_hosts_test.rb deleted file mode 100644 index 2d826e39..00000000 --- a/webclient/test/integration/manage_hosts_test.rb +++ /dev/null @@ -1,82 +0,0 @@ -#-- -# Webyast Webservice framework -# -# Copyright (C) 2009, 2010 Novell, Inc. -# This library is free software; you can redistribute it and/or modify -# it only under the terms of version 2.1 of the GNU Lesser General Public -# License as published by the Free Software Foundation. -# -# This library is distributed in the hope that it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more -# details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -#++ - -# -# test/integration/manage_hosts_test.rb -# -# -require File.expand_path(File.dirname(__FILE__) + "/../test_helper") - -class ManageHostsTest < ActionController::IntegrationTest - fixtures :accounts - - # add a new host - test "add a new host and submit" do - list_hosts - - # push "add" button - get "hosts/new" - assert_response :success - - # enter form and push "create" - post "hosts/create", "host[name]" => "localhost", "host[url]" => "http://localhost:81", "host[description]" => "This is a test" - - # create redirects to index - assert_response :redirect - follow_redirect! - -#FIXME assert flash[:notice] - assert_template "hosts/index" - end - - # add a new host with a bad url - test "add a new host with a bad url" do - get "/" - assert_response :redirect - - # push "add" button - get "hosts/new" - assert_response :success - - # enter form and push "create" - post "hosts/create", "host[name]" => "localhost", "host[url]" => "foo", "host[description]" => "This has a bad url" - - # create redirects to new and reports error - assert_response :redirect - follow_redirect! - -#FIXME assert flash[:warning] - assert_template "hosts/new" - end - - - private - def list_hosts -# main_controller defaults to localhost in appliances -# get "/" -# assert_response :redirect -# follow_redirect! - get "sessions/new" - # now at session/new - # we dont have a host yet - assert_response :redirect - follow_redirect! - # now at hosts/index - assert_template "hosts/index" - end -end