Commit 24bc3c87f604a9985c554e19833e0f309c05cb89

Authored by Leandro Santos
1 parent 892f430c

removing html validation to remove tidy dependency. This library is not mantaine…

…d anymore. Otherwise there is more effectively method to validate html nowadays
test/functional/account_controller_test.rb
@@ -25,10 +25,6 @@ class AccountControllerTest < ActionController::TestCase @@ -25,10 +25,6 @@ class AccountControllerTest < ActionController::TestCase
25 assert_local_files_reference 25 assert_local_files_reference
26 end 26 end
27 27
28 - def test_valid_xhtml  
29 - assert_valid_xhtml  
30 - end  
31 -  
32 def test_should_login_and_redirect 28 def test_should_login_and_redirect
33 post :login, :user => {:login => 'johndoe', :password => 'test'} 29 post :login, :user => {:login => 'johndoe', :password => 'test'}
34 assert session[:user] 30 assert session[:user]
test/functional/admin_panel_controller_test.rb
@@ -18,10 +18,6 @@ class AdminPanelControllerTest < ActionController::TestCase @@ -18,10 +18,6 @@ class AdminPanelControllerTest < ActionController::TestCase
18 assert_local_files_reference 18 assert_local_files_reference
19 end 19 end
20 20
21 - def test_valid_xhtml  
22 - assert_valid_xhtml  
23 - end  
24 -  
25 should 'manage the correct environment' do 21 should 'manage the correct environment' do
26 current = fast_create(Environment, :name => 'test environment', :is_default => false) 22 current = fast_create(Environment, :name => 'test environment', :is_default => false)
27 current.domains.create!(:name => 'example.com') 23 current.domains.create!(:name => 'example.com')
test/functional/application_controller_test.rb
@@ -64,10 +64,6 @@ class ApplicationControllerTest < ActionController::TestCase @@ -64,10 +64,6 @@ class ApplicationControllerTest < ActionController::TestCase
64 assert_local_files_reference 64 assert_local_files_reference
65 end 65 end
66 66
67 - def test_valid_xhtml  
68 - assert_valid_xhtml  
69 - end  
70 -  
71 def test_exist_environment_variable_to_helper_environment_identification 67 def test_exist_environment_variable_to_helper_environment_identification
72 get :index 68 get :index
73 assert_not_nil assigns(:environment) 69 assert_not_nil assigns(:environment)
test/functional/catalog_controller_test.rb
@@ -20,10 +20,6 @@ class CatalogControllerTest < ActionController::TestCase @@ -20,10 +20,6 @@ class CatalogControllerTest < ActionController::TestCase
20 assert_local_files_reference :get, :index, :profile => @enterprise.identifier 20 assert_local_files_reference :get, :index, :profile => @enterprise.identifier
21 end 21 end
22 22
23 - def test_valid_xhtml  
24 - assert_valid_xhtml  
25 - end  
26 -  
27 should 'not display for non-enterprises' do 23 should 'not display for non-enterprises' do
28 u = create_user('testinguser').person 24 u = create_user('testinguser').person
29 get :index, :profile => 'testinguser' 25 get :index, :profile => 'testinguser'
test/functional/categories_controller_test.rb
@@ -24,10 +24,6 @@ class CategoriesControllerTest < ActionController::TestCase @@ -24,10 +24,6 @@ class CategoriesControllerTest < ActionController::TestCase
24 assert_local_files_reference 24 assert_local_files_reference
25 end 25 end
26 26
27 - def test_valid_xhtml  
28 - assert_valid_xhtml  
29 - end  
30 -  
31 def test_index 27 def test_index
32 login_as(create_admin_user(Environment.default)) 28 login_as(create_admin_user(Environment.default))
33 get :index 29 get :index
test/functional/cms_controller_test.rb
@@ -22,10 +22,6 @@ class CmsControllerTest < ActionController::TestCase @@ -22,10 +22,6 @@ class CmsControllerTest < ActionController::TestCase
22 assert_local_files_reference :get, :index, :profile => profile.identifier 22 assert_local_files_reference :get, :index, :profile => profile.identifier
23 end 23 end
24 24
25 - def test_valid_xhtml  
26 - assert_valid_xhtml  
27 - end  
28 -  
29 should 'list top level documents on index' do 25 should 'list top level documents on index' do
30 get :index, :profile => profile.identifier 26 get :index, :profile => profile.identifier
31 27
test/functional/content_viewer_controller_test.rb
@@ -24,10 +24,6 @@ class ContentViewerControllerTest < ActionController::TestCase @@ -24,10 +24,6 @@ class ContentViewerControllerTest < ActionController::TestCase
24 assert_local_files_reference :get, :view_page, :profile => profile.identifier, :page => [ 'test' ] 24 assert_local_files_reference :get, :view_page, :profile => profile.identifier, :page => [ 'test' ]
25 end 25 end
26 26
27 - def test_valid_xhtml  
28 - assert_valid_xhtml  
29 - end  
30 -  
31 def test_should_display_page 27 def test_should_display_page
32 page = profile.articles.build(:name => 'test') 28 page = profile.articles.build(:name => 'test')
33 page.save! 29 page.save!
test/functional/edit_template_controller_test.rb
@@ -19,10 +19,6 @@ class EditTemplateControllerTest < ActionController::TestCase @@ -19,10 +19,6 @@ class EditTemplateControllerTest < ActionController::TestCase
19 assert_local_files_reference 19 assert_local_files_reference
20 end 20 end
21 21
22 - def test_valid_xhtml  
23 - assert_valid_xhtml  
24 - end  
25 -  
26 def test_redirect_to_design_editor_when_index_action_is_called 22 def test_redirect_to_design_editor_when_index_action_is_called
27 give_permission('ze', 'edit_environment_design', Environment.default) 23 give_permission('ze', 'edit_environment_design', Environment.default)
28 get :index 24 get :index
test/functional/enterprise_registration_controller_test.rb
@@ -21,10 +21,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase @@ -21,10 +21,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase
21 assert_local_files_reference 21 assert_local_files_reference
22 end 22 end
23 23
24 - def test_valid_xhtml  
25 - assert_valid_xhtml  
26 - end  
27 -  
28 should 'go to the first step on index' do 24 should 'go to the first step on index' do
29 get :index 25 get :index
30 assert_response :success 26 assert_response :success
test/functional/enterprise_validation_controller_test.rb
@@ -23,14 +23,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase @@ -23,14 +23,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase
23 assert_local_files_reference :get, :index, :profile => 'myorg' 23 assert_local_files_reference :get, :index, :profile => 'myorg'
24 end 24 end
25 25
26 - def test_valid_xhtml  
27 -  
28 - # FIXME remove this after enable assert_valid_xhtml  
29 - Profile.find_by_identifier('myorg')  
30 -  
31 - assert_valid_xhtml :get, :index, :profile => 'myorg'  
32 - end  
33 -  
34 should 'list pending validations on index' do 26 should 'list pending validations on index' do
35 empty = [] 27 empty = []
36 @org.expects(:pending_validations).returns(empty) 28 @org.expects(:pending_validations).returns(empty)
test/functional/environment_design_controller_test.rb
@@ -21,10 +21,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase @@ -21,10 +21,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase
21 assert_local_files_reference 21 assert_local_files_reference
22 end 22 end
23 23
24 - def test_valid_xhtml  
25 - assert_valid_xhtml  
26 - end  
27 -  
28 should 'indicate only actual blocks as such' do 24 should 'indicate only actual blocks as such' do
29 assert(@controller.available_blocks.all? {|item| item.new.is_a? Block}) 25 assert(@controller.available_blocks.all? {|item| item.new.is_a? Block})
30 end 26 end
test/functional/environment_role_manager_controller_test.rb
@@ -15,12 +15,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase @@ -15,12 +15,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase
15 assert_local_files_reference 15 assert_local_files_reference
16 end 16 end
17 17
18 - def test_valid_xhtml  
19 - assert_valid_xhtml  
20 - end  
21 -  
22 - # Replace this with your real tests.  
23 - def test_truth  
24 - assert true  
25 - end  
26 end 18 end
test/functional/favorite_enterprises_controller_test.rb
@@ -22,10 +22,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase @@ -22,10 +22,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase
22 assert_local_files_reference 22 assert_local_files_reference
23 end 23 end
24 24
25 - def test_valid_xhtml  
26 - assert_valid_xhtml  
27 - end  
28 -  
29 should 'list favorite enterprises' do 25 should 'list favorite enterprises' do
30 get :index 26 get :index
31 assert_response :success 27 assert_response :success
test/functional/features_controller_test.rb
@@ -18,10 +18,6 @@ class FeaturesControllerTest < ActionController::TestCase @@ -18,10 +18,6 @@ class FeaturesControllerTest < ActionController::TestCase
18 assert_local_files_reference 18 assert_local_files_reference
19 end 19 end
20 20
21 - def test_valid_xhtml  
22 - assert_valid_xhtml  
23 - end  
24 -  
25 def test_listing_features 21 def test_listing_features
26 uses_host 'anhetegua.net' 22 uses_host 'anhetegua.net'
27 get :index 23 get :index
test/functional/friends_controller_test.rb
@@ -22,10 +22,6 @@ class FriendsControllerTest < ActionController::TestCase @@ -22,10 +22,6 @@ class FriendsControllerTest < ActionController::TestCase
22 assert_local_files_reference 22 assert_local_files_reference
23 end 23 end
24 24
25 - def test_valid_xhtml  
26 - assert_valid_xhtml  
27 - end  
28 -  
29 should 'list friends' do 25 should 'list friends' do
30 get :index 26 get :index
31 assert_response :success 27 assert_response :success
test/functional/home_controller_test.rb
@@ -21,10 +21,6 @@ class HomeControllerTest < ActionController::TestCase @@ -21,10 +21,6 @@ class HomeControllerTest < ActionController::TestCase
21 assert_local_files_reference 21 assert_local_files_reference
22 end 22 end
23 23
24 - def test_valid_xhtml  
25 - assert_valid_xhtml  
26 - end  
27 -  
28 should 'not display news from portal if disabled in environment' do 24 should 'not display news from portal if disabled in environment' do
29 env = Environment.default 25 env = Environment.default
30 env.disable('use_portal_community') 26 env.disable('use_portal_community')
test/functional/manage_products_controller_test.rb
@@ -22,10 +22,6 @@ class ManageProductsControllerTest < ActionController::TestCase @@ -22,10 +22,6 @@ class ManageProductsControllerTest < ActionController::TestCase
22 assert_local_files_reference :get, :index, :profile => @enterprise.identifier 22 assert_local_files_reference :get, :index, :profile => @enterprise.identifier
23 end 23 end
24 24
25 - def test_valid_xhtml  
26 - assert_valid_xhtml  
27 - end  
28 -  
29 should "not have permission" do 25 should "not have permission" do
30 u = create_user('user_test') 26 u = create_user('user_test')
31 login_as :user_test 27 login_as :user_test
test/functional/memberships_controller_test.rb
@@ -23,10 +23,6 @@ class MembershipsControllerTest < ActionController::TestCase @@ -23,10 +23,6 @@ class MembershipsControllerTest < ActionController::TestCase
23 assert_local_files_reference :get, :index, :profile => profile.identifier 23 assert_local_files_reference :get, :index, :profile => profile.identifier
24 end 24 end
25 25
26 - def test_valid_xhtml  
27 - assert_valid_xhtml  
28 - end  
29 -  
30 should 'list current memberships' do 26 should 'list current memberships' do
31 get :index, :profile => profile.identifier 27 get :index, :profile => profile.identifier
32 28
test/functional/my_profile_controller_test.rb
@@ -26,10 +26,6 @@ class MyProfileControllerTest < ActionController::TestCase @@ -26,10 +26,6 @@ class MyProfileControllerTest < ActionController::TestCase
26 assert_local_files_reference :get, :index, :profile => user.identifier 26 assert_local_files_reference :get, :index, :profile => user.identifier
27 end 27 end
28 28
29 - def test_valid_xhtml  
30 - assert_valid_xhtml  
31 - end  
32 -  
33 def test_should_allow_person 29 def test_should_allow_person
34 @controller = OnlyForPersonTestController.new 30 @controller = OnlyForPersonTestController.new
35 person = create_user('random_joe') 31 person = create_user('random_joe')
test/functional/plugins_controller_test.rb
@@ -20,10 +20,6 @@ class PluginsControllerTest < ActionController::TestCase @@ -20,10 +20,6 @@ class PluginsControllerTest < ActionController::TestCase
20 assert_local_files_reference 20 assert_local_files_reference
21 end 21 end
22 22
23 - def test_valid_xhtml  
24 - assert_valid_xhtml  
25 - end  
26 -  
27 should 'list system active plugins' do 23 should 'list system active plugins' do
28 class Plugin1 < Noosfero::Plugin 24 class Plugin1 < Noosfero::Plugin
29 class << self 25 class << self
test/functional/profile_controller_test.rb
@@ -15,10 +15,6 @@ class ProfileControllerTest &lt; ActionController::TestCase @@ -15,10 +15,6 @@ class ProfileControllerTest &lt; ActionController::TestCase
15 assert_local_files_reference 15 assert_local_files_reference
16 end 16 end
17 17
18 - def test_valid_xhtml  
19 - assert_valid_xhtml  
20 - end  
21 -  
22 noosfero_test :profile => 'testuser' 18 noosfero_test :profile => 'testuser'
23 19
24 should 'list friends' do 20 should 'list friends' do
test/functional/profile_design_controller_test.rb
@@ -79,10 +79,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase @@ -79,10 +79,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
79 assert_local_files_reference :get, :index, :profile => 'designtestuser' 79 assert_local_files_reference :get, :index, :profile => 'designtestuser'
80 end 80 end
81 81
82 - def test_valid_xhtml  
83 - assert_valid_xhtml  
84 - end  
85 -  
86 ###################################################### 82 ######################################################
87 # BEGIN - tests for BoxOrganizerController features 83 # BEGIN - tests for BoxOrganizerController features
88 ###################################################### 84 ######################################################
test/functional/profile_editor_controller_test.rb
@@ -20,11 +20,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase @@ -20,11 +20,7 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
20 def test_local_files_reference 20 def test_local_files_reference
21 assert_local_files_reference :get, :index, :profile => profile.identifier 21 assert_local_files_reference :get, :index, :profile => profile.identifier
22 end 22 end
23 -  
24 - def test_valid_xhtml  
25 - assert_valid_xhtml  
26 - end  
27 - 23 +
28 def test_index 24 def test_index
29 get :index, :profile => profile.identifier 25 get :index, :profile => profile.identifier
30 assert_template 'index' 26 assert_template 'index'
test/functional/profile_members_controller_test.rb
@@ -17,10 +17,6 @@ class ProfileMembersControllerTest &lt; ActionController::TestCase @@ -17,10 +17,6 @@ class ProfileMembersControllerTest &lt; ActionController::TestCase
17 assert_local_files_reference :get, :index, :profile => user.identifier 17 assert_local_files_reference :get, :index, :profile => user.identifier
18 end 18 end
19 19
20 - def test_valid_xhtml  
21 - assert_valid_xhtml  
22 - end  
23 -  
24 should 'not access index if dont have permission' do 20 should 'not access index if dont have permission' do
25 user = create_user('test_user') 21 user = create_user('test_user')
26 fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'test enterprise') 22 fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'test enterprise')
test/functional/region_validators_controller_test.rb
@@ -17,10 +17,6 @@ class RegionValidatorsControllerTest &lt; ActionController::TestCase @@ -17,10 +17,6 @@ class RegionValidatorsControllerTest &lt; ActionController::TestCase
17 assert_local_files_reference 17 assert_local_files_reference
18 end 18 end
19 19
20 - def test_valid_xhtml  
21 - assert_valid_xhtml  
22 - end  
23 -  
24 # Replace this with your real tests. 20 # Replace this with your real tests.
25 should 'list regions at index' do 21 should 'list regions at index' do
26 get :index 22 get :index
test/functional/role_controller_test.rb
@@ -19,10 +19,6 @@ class RoleControllerTest &lt; ActionController::TestCase @@ -19,10 +19,6 @@ class RoleControllerTest &lt; ActionController::TestCase
19 assert_local_files_reference 19 assert_local_files_reference
20 end 20 end
21 21
22 - def test_valid_xhtml  
23 - assert_valid_xhtml  
24 - end  
25 -  
26 def test_index_should_get_roles 22 def test_index_should_get_roles
27 get 'index' 23 get 'index'
28 assert_response :success 24 assert_response :success
test/functional/search_controller_test.rb
@@ -49,10 +49,6 @@ class SearchControllerTest &lt; ActionController::TestCase @@ -49,10 +49,6 @@ class SearchControllerTest &lt; ActionController::TestCase
49 assert_local_files_reference 49 assert_local_files_reference
50 end 50 end
51 51
52 - def test_valid_xhtml  
53 - assert_valid_xhtml  
54 - end  
55 -  
56 should 'espape xss attack' do 52 should 'espape xss attack' do
57 get 'index', :query => '<wslite>' 53 get 'index', :query => '<wslite>'
58 assert_no_tag :tag => 'wslite' 54 assert_no_tag :tag => 'wslite'
test/functional/tasks_controller_test.rb
@@ -26,10 +26,6 @@ class TasksControllerTest &lt; ActionController::TestCase @@ -26,10 +26,6 @@ class TasksControllerTest &lt; ActionController::TestCase
26 assert_local_files_reference 26 assert_local_files_reference
27 end 27 end
28 28
29 - def test_valid_xhtml  
30 - assert_valid_xhtml  
31 - end  
32 -  
33 should 'list pending tasks' do 29 should 'list pending tasks' do
34 get :index 30 get :index
35 31
test/test_helper.rb
@@ -3,7 +3,6 @@ ENV[&quot;RAILS_ENV&quot;] = &quot;test&quot; @@ -3,7 +3,6 @@ ENV[&quot;RAILS_ENV&quot;] = &quot;test&quot;
3 require File.expand_path(File.dirname(__FILE__) + "/../config/environment") 3 require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
4 require 'rails/test_help' 4 require 'rails/test_help'
5 require 'mocha' 5 require 'mocha'
6 -require 'tidy'  
7 require 'hpricot' 6 require 'hpricot'
8 7
9 require 'noosfero/test' 8 require 'noosfero/test'
@@ -111,23 +110,6 @@ class ActiveSupport::TestCase @@ -111,23 +110,6 @@ class ActiveSupport::TestCase
111 assert_equal parent, child.superclass, "Class #{child} expected to be a subclass of #{parent}" 110 assert_equal parent, child.superclass, "Class #{child} expected to be a subclass of #{parent}"
112 end 111 end
113 112
114 - def assert_valid_xhtml(method=:get, action=:index, params = {})  
115 - return true  
116 - if method.to_s() == 'post'  
117 - post action, params  
118 - else  
119 - get action, params  
120 - end  
121 - tidy = Tidy.open(:show_warnings=>false)  
122 - tidy.options.output_xml = true  
123 - tidy.clean @response.body  
124 - if tidy.errors  
125 - flunk "HTML ERROR - Tidy Diagnostics:\n "+  
126 - tidy.errors.join("\n ") +"\n "+  
127 - tidy.diagnostics.join("\n ")  
128 - end  
129 - end  
130 -  
131 def assert_local_files_reference(method=:get, action=:index, params = {}) 113 def assert_local_files_reference(method=:get, action=:index, params = {})
132 if method.to_s() == 'post' 114 if method.to_s() == 'post'
133 post action, params 115 post action, params