From 24bc3c87f604a9985c554e19833e0f309c05cb89 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Thu, 26 Jun 2014 12:40:43 -0300 Subject: [PATCH] removing html validation to remove tidy dependency. This library is not mantained anymore. Otherwise there is more effectively method to validate html nowadays --- test/functional/account_controller_test.rb | 4 ---- test/functional/admin_panel_controller_test.rb | 4 ---- test/functional/application_controller_test.rb | 4 ---- test/functional/catalog_controller_test.rb | 4 ---- test/functional/categories_controller_test.rb | 4 ---- test/functional/cms_controller_test.rb | 4 ---- test/functional/content_viewer_controller_test.rb | 4 ---- test/functional/edit_template_controller_test.rb | 4 ---- test/functional/enterprise_registration_controller_test.rb | 4 ---- test/functional/enterprise_validation_controller_test.rb | 8 -------- test/functional/environment_design_controller_test.rb | 4 ---- test/functional/environment_role_manager_controller_test.rb | 8 -------- test/functional/favorite_enterprises_controller_test.rb | 4 ---- test/functional/features_controller_test.rb | 4 ---- test/functional/friends_controller_test.rb | 4 ---- test/functional/home_controller_test.rb | 4 ---- test/functional/manage_products_controller_test.rb | 4 ---- test/functional/memberships_controller_test.rb | 4 ---- test/functional/my_profile_controller_test.rb | 4 ---- test/functional/plugins_controller_test.rb | 4 ---- test/functional/profile_controller_test.rb | 4 ---- test/functional/profile_design_controller_test.rb | 4 ---- test/functional/profile_editor_controller_test.rb | 6 +----- test/functional/profile_members_controller_test.rb | 4 ---- test/functional/region_validators_controller_test.rb | 4 ---- test/functional/role_controller_test.rb | 4 ---- test/functional/search_controller_test.rb | 4 ---- test/functional/tasks_controller_test.rb | 4 ---- test/test_helper.rb | 18 ------------------ 29 files changed, 1 insertion(+), 139 deletions(-) diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 65645e3..785ede1 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -25,10 +25,6 @@ class AccountControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - def test_should_login_and_redirect post :login, :user => {:login => 'johndoe', :password => 'test'} assert session[:user] diff --git a/test/functional/admin_panel_controller_test.rb b/test/functional/admin_panel_controller_test.rb index 6980bcb..b5e6634 100644 --- a/test/functional/admin_panel_controller_test.rb +++ b/test/functional/admin_panel_controller_test.rb @@ -18,10 +18,6 @@ class AdminPanelControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'manage the correct environment' do current = fast_create(Environment, :name => 'test environment', :is_default => false) current.domains.create!(:name => 'example.com') diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 1affcd3..a98c71a 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -64,10 +64,6 @@ class ApplicationControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - def test_exist_environment_variable_to_helper_environment_identification get :index assert_not_nil assigns(:environment) diff --git a/test/functional/catalog_controller_test.rb b/test/functional/catalog_controller_test.rb index 6419c90..66f295c 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -20,10 +20,6 @@ class CatalogControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => @enterprise.identifier end - def test_valid_xhtml - assert_valid_xhtml - end - should 'not display for non-enterprises' do u = create_user('testinguser').person get :index, :profile => 'testinguser' diff --git a/test/functional/categories_controller_test.rb b/test/functional/categories_controller_test.rb index ce4737c..96cdbc3 100644 --- a/test/functional/categories_controller_test.rb +++ b/test/functional/categories_controller_test.rb @@ -24,10 +24,6 @@ class CategoriesControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - def test_index login_as(create_admin_user(Environment.default)) get :index diff --git a/test/functional/cms_controller_test.rb b/test/functional/cms_controller_test.rb index 9eb1c37..04b7486 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -22,10 +22,6 @@ class CmsControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => profile.identifier end - def test_valid_xhtml - assert_valid_xhtml - end - should 'list top level documents on index' do get :index, :profile => profile.identifier diff --git a/test/functional/content_viewer_controller_test.rb b/test/functional/content_viewer_controller_test.rb index 03a48aa..dbf607d 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -24,10 +24,6 @@ class ContentViewerControllerTest < ActionController::TestCase assert_local_files_reference :get, :view_page, :profile => profile.identifier, :page => [ 'test' ] end - def test_valid_xhtml - assert_valid_xhtml - end - def test_should_display_page page = profile.articles.build(:name => 'test') page.save! diff --git a/test/functional/edit_template_controller_test.rb b/test/functional/edit_template_controller_test.rb index 056603b..4280150 100644 --- a/test/functional/edit_template_controller_test.rb +++ b/test/functional/edit_template_controller_test.rb @@ -19,10 +19,6 @@ class EditTemplateControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - def test_redirect_to_design_editor_when_index_action_is_called give_permission('ze', 'edit_environment_design', Environment.default) get :index diff --git a/test/functional/enterprise_registration_controller_test.rb b/test/functional/enterprise_registration_controller_test.rb index 1a9213e..934f139 100644 --- a/test/functional/enterprise_registration_controller_test.rb +++ b/test/functional/enterprise_registration_controller_test.rb @@ -21,10 +21,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'go to the first step on index' do get :index assert_response :success diff --git a/test/functional/enterprise_validation_controller_test.rb b/test/functional/enterprise_validation_controller_test.rb index 13d2305..6aa9ac8 100644 --- a/test/functional/enterprise_validation_controller_test.rb +++ b/test/functional/enterprise_validation_controller_test.rb @@ -23,14 +23,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => 'myorg' end - def test_valid_xhtml - - # FIXME remove this after enable assert_valid_xhtml - Profile.find_by_identifier('myorg') - - assert_valid_xhtml :get, :index, :profile => 'myorg' - end - should 'list pending validations on index' do empty = [] @org.expects(:pending_validations).returns(empty) diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb index d2d456a..a95db24 100644 --- a/test/functional/environment_design_controller_test.rb +++ b/test/functional/environment_design_controller_test.rb @@ -21,10 +21,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'indicate only actual blocks as such' do assert(@controller.available_blocks.all? {|item| item.new.is_a? Block}) end diff --git a/test/functional/environment_role_manager_controller_test.rb b/test/functional/environment_role_manager_controller_test.rb index 9f22720..d32ad83 100644 --- a/test/functional/environment_role_manager_controller_test.rb +++ b/test/functional/environment_role_manager_controller_test.rb @@ -15,12 +15,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - - # Replace this with your real tests. - def test_truth - assert true - end end diff --git a/test/functional/favorite_enterprises_controller_test.rb b/test/functional/favorite_enterprises_controller_test.rb index 0d51347..429ff9d 100644 --- a/test/functional/favorite_enterprises_controller_test.rb +++ b/test/functional/favorite_enterprises_controller_test.rb @@ -22,10 +22,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'list favorite enterprises' do get :index assert_response :success diff --git a/test/functional/features_controller_test.rb b/test/functional/features_controller_test.rb index 6c56915..f4785f2 100644 --- a/test/functional/features_controller_test.rb +++ b/test/functional/features_controller_test.rb @@ -18,10 +18,6 @@ class FeaturesControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - def test_listing_features uses_host 'anhetegua.net' get :index diff --git a/test/functional/friends_controller_test.rb b/test/functional/friends_controller_test.rb index 153dde0..7264d2d 100644 --- a/test/functional/friends_controller_test.rb +++ b/test/functional/friends_controller_test.rb @@ -22,10 +22,6 @@ class FriendsControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'list friends' do get :index assert_response :success diff --git a/test/functional/home_controller_test.rb b/test/functional/home_controller_test.rb index c4578a6..df97ca2 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -21,10 +21,6 @@ class HomeControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'not display news from portal if disabled in environment' do env = Environment.default env.disable('use_portal_community') diff --git a/test/functional/manage_products_controller_test.rb b/test/functional/manage_products_controller_test.rb index 7f0a877..6404e3a 100644 --- a/test/functional/manage_products_controller_test.rb +++ b/test/functional/manage_products_controller_test.rb @@ -22,10 +22,6 @@ class ManageProductsControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => @enterprise.identifier end - def test_valid_xhtml - assert_valid_xhtml - end - should "not have permission" do u = create_user('user_test') login_as :user_test diff --git a/test/functional/memberships_controller_test.rb b/test/functional/memberships_controller_test.rb index 5f69ac5..a617e11 100644 --- a/test/functional/memberships_controller_test.rb +++ b/test/functional/memberships_controller_test.rb @@ -23,10 +23,6 @@ class MembershipsControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => profile.identifier end - def test_valid_xhtml - assert_valid_xhtml - end - should 'list current memberships' do get :index, :profile => profile.identifier diff --git a/test/functional/my_profile_controller_test.rb b/test/functional/my_profile_controller_test.rb index 18561a9..87c33fc 100644 --- a/test/functional/my_profile_controller_test.rb +++ b/test/functional/my_profile_controller_test.rb @@ -26,10 +26,6 @@ class MyProfileControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => user.identifier end - def test_valid_xhtml - assert_valid_xhtml - end - def test_should_allow_person @controller = OnlyForPersonTestController.new person = create_user('random_joe') diff --git a/test/functional/plugins_controller_test.rb b/test/functional/plugins_controller_test.rb index 9478f4e..2c53ed9 100644 --- a/test/functional/plugins_controller_test.rb +++ b/test/functional/plugins_controller_test.rb @@ -20,10 +20,6 @@ class PluginsControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'list system active plugins' do class Plugin1 < Noosfero::Plugin class << self diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index f18d909..04b0012 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -15,10 +15,6 @@ class ProfileControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - noosfero_test :profile => 'testuser' should 'list friends' do diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index cd9bc6a..f58b3d4 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -79,10 +79,6 @@ class ProfileDesignControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => 'designtestuser' end - def test_valid_xhtml - assert_valid_xhtml - end - ###################################################### # BEGIN - tests for BoxOrganizerController features ###################################################### diff --git a/test/functional/profile_editor_controller_test.rb b/test/functional/profile_editor_controller_test.rb index a6b0f28..7a2c4a5 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -20,11 +20,7 @@ class ProfileEditorControllerTest < ActionController::TestCase def test_local_files_reference assert_local_files_reference :get, :index, :profile => profile.identifier end - - def test_valid_xhtml - assert_valid_xhtml - end - + def test_index get :index, :profile => profile.identifier assert_template 'index' diff --git a/test/functional/profile_members_controller_test.rb b/test/functional/profile_members_controller_test.rb index 0177d81..86838a9 100644 --- a/test/functional/profile_members_controller_test.rb +++ b/test/functional/profile_members_controller_test.rb @@ -17,10 +17,6 @@ class ProfileMembersControllerTest < ActionController::TestCase assert_local_files_reference :get, :index, :profile => user.identifier end - def test_valid_xhtml - assert_valid_xhtml - end - should 'not access index if dont have permission' do user = create_user('test_user') fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'test enterprise') diff --git a/test/functional/region_validators_controller_test.rb b/test/functional/region_validators_controller_test.rb index 7449ca0..a5cc544 100644 --- a/test/functional/region_validators_controller_test.rb +++ b/test/functional/region_validators_controller_test.rb @@ -17,10 +17,6 @@ class RegionValidatorsControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - # Replace this with your real tests. should 'list regions at index' do get :index diff --git a/test/functional/role_controller_test.rb b/test/functional/role_controller_test.rb index 10bc6f7..c1156b8 100644 --- a/test/functional/role_controller_test.rb +++ b/test/functional/role_controller_test.rb @@ -19,10 +19,6 @@ class RoleControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - def test_index_should_get_roles get 'index' assert_response :success diff --git a/test/functional/search_controller_test.rb b/test/functional/search_controller_test.rb index 83a407a..f28d016 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -49,10 +49,6 @@ class SearchControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'espape xss attack' do get 'index', :query => '' assert_no_tag :tag => 'wslite' diff --git a/test/functional/tasks_controller_test.rb b/test/functional/tasks_controller_test.rb index 0b61258..5cdfc52 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -26,10 +26,6 @@ class TasksControllerTest < ActionController::TestCase assert_local_files_reference end - def test_valid_xhtml - assert_valid_xhtml - end - should 'list pending tasks' do get :index diff --git a/test/test_helper.rb b/test/test_helper.rb index dcb70c5..d574773 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -3,7 +3,6 @@ ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require 'rails/test_help' require 'mocha' -require 'tidy' require 'hpricot' require 'noosfero/test' @@ -111,23 +110,6 @@ class ActiveSupport::TestCase assert_equal parent, child.superclass, "Class #{child} expected to be a subclass of #{parent}" end - def assert_valid_xhtml(method=:get, action=:index, params = {}) - return true - if method.to_s() == 'post' - post action, params - else - get action, params - end - tidy = Tidy.open(:show_warnings=>false) - tidy.options.output_xml = true - tidy.clean @response.body - if tidy.errors - flunk "HTML ERROR - Tidy Diagnostics:\n "+ - tidy.errors.join("\n ") +"\n "+ - tidy.diagnostics.join("\n ") - end - end - def assert_local_files_reference(method=:get, action=:index, params = {}) if method.to_s() == 'post' post action, params -- libgit2 0.21.2