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