From a20452cdf0df6b1e7b0dddbcadaa2cf68bc60ec0 Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Thu, 26 Jun 2014 17:13:10 -0300 Subject: [PATCH] removing assert_local_files_reference from test helper and its references. These tests does not make sense --- 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 | 6 ------ test/functional/edit_template_controller_test.rb | 4 ---- test/functional/enterprise_registration_controller_test.rb | 4 ---- test/functional/enterprise_validation_controller_test.rb | 4 ---- test/functional/environment_design_controller_test.rb | 4 ---- test/functional/environment_role_manager_controller_test.rb | 4 ---- 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 | 6 ------ 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 | 4 ---- test/functional/profile_members_controller_test.rb | 5 ----- 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 | 33 --------------------------------- 29 files changed, 0 insertions(+), 150 deletions(-) diff --git a/test/functional/account_controller_test.rb b/test/functional/account_controller_test.rb index 785ede1..b2879b9 100644 --- a/test/functional/account_controller_test.rb +++ b/test/functional/account_controller_test.rb @@ -21,10 +21,6 @@ class AccountControllerTest < ActionController::TestCase disable_signup_bot_check end - def test_local_files_reference - assert_local_files_reference - 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 b5e6634..55db96c 100644 --- a/test/functional/admin_panel_controller_test.rb +++ b/test/functional/admin_panel_controller_test.rb @@ -14,10 +14,6 @@ class AdminPanelControllerTest < ActionController::TestCase login_as(create_admin_user(Environment.default)) end - def test_local_files_reference - assert_local_files_reference - 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 a98c71a..72d7b38 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -60,10 +60,6 @@ class ApplicationControllerTest < ActionController::TestCase end - def test_local_files_reference - assert_local_files_reference - 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 66f295c..9ba4849 100644 --- a/test/functional/catalog_controller_test.rb +++ b/test/functional/catalog_controller_test.rb @@ -16,10 +16,6 @@ class CatalogControllerTest < ActionController::TestCase end attr_accessor :enterprise - def test_local_files_reference - assert_local_files_reference :get, :index, :profile => @enterprise.identifier - 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 96cdbc3..8917ec6 100644 --- a/test/functional/categories_controller_test.rb +++ b/test/functional/categories_controller_test.rb @@ -20,10 +20,6 @@ class CategoriesControllerTest < ActionController::TestCase attr_reader :env, :cat1, :cat2 - def test_local_files_reference - assert_local_files_reference - 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 04b7486..f31b09a 100644 --- a/test/functional/cms_controller_test.rb +++ b/test/functional/cms_controller_test.rb @@ -18,10 +18,6 @@ class CmsControllerTest < ActionController::TestCase attr_reader :profile - def test_local_files_reference - assert_local_files_reference :get, :index, :profile => profile.identifier - 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 dbf607d..bc78b31 100644 --- a/test/functional/content_viewer_controller_test.rb +++ b/test/functional/content_viewer_controller_test.rb @@ -18,12 +18,6 @@ class ContentViewerControllerTest < ActionController::TestCase end attr_reader :profile, :environment - def test_local_files_reference - page = profile.articles.build(:name => 'test') - page.save! - assert_local_files_reference :get, :view_page, :profile => profile.identifier, :page => [ 'test' ] - 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 4280150..3f5572b 100644 --- a/test/functional/edit_template_controller_test.rb +++ b/test/functional/edit_template_controller_test.rb @@ -15,10 +15,6 @@ class EditTemplateControllerTest < ActionController::TestCase login_as 'ze' end - def test_local_files_reference - assert_local_files_reference - 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 934f139..cc2f9a9 100644 --- a/test/functional/enterprise_registration_controller_test.rb +++ b/test/functional/enterprise_registration_controller_test.rb @@ -17,10 +17,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase login_as 'ze' end - def test_local_files_reference - assert_local_files_reference - 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 6aa9ac8..a2f4002 100644 --- a/test/functional/enterprise_validation_controller_test.rb +++ b/test/functional/enterprise_validation_controller_test.rb @@ -19,10 +19,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase Profile.expects(:find_by_identifier).with('myorg').returns(@org).at_least_once end - def test_local_files_reference - assert_local_files_reference :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 a95db24..674c476 100644 --- a/test/functional/environment_design_controller_test.rb +++ b/test/functional/environment_design_controller_test.rb @@ -17,10 +17,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) end - def test_local_files_reference - assert_local_files_reference - 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 d32ad83..822933c 100644 --- a/test/functional/environment_role_manager_controller_test.rb +++ b/test/functional/environment_role_manager_controller_test.rb @@ -11,8 +11,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new end - def test_local_files_reference - assert_local_files_reference - end - end diff --git a/test/functional/favorite_enterprises_controller_test.rb b/test/functional/favorite_enterprises_controller_test.rb index 429ff9d..78412af 100644 --- a/test/functional/favorite_enterprises_controller_test.rb +++ b/test/functional/favorite_enterprises_controller_test.rb @@ -18,10 +18,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase end attr_accessor :profile, :favorite_enterprise - def test_local_files_reference - assert_local_files_reference - 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 f4785f2..e291fba 100644 --- a/test/functional/features_controller_test.rb +++ b/test/functional/features_controller_test.rb @@ -14,10 +14,6 @@ class FeaturesControllerTest < ActionController::TestCase login_as(create_admin_user(Environment.find(2))) end - def test_local_files_reference - assert_local_files_reference - 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 7264d2d..c692e85 100644 --- a/test/functional/friends_controller_test.rb +++ b/test/functional/friends_controller_test.rb @@ -18,10 +18,6 @@ class FriendsControllerTest < ActionController::TestCase end attr_accessor :profile, :friend - def test_local_files_reference - assert_local_files_reference - 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 df97ca2..855c61e 100644 --- a/test/functional/home_controller_test.rb +++ b/test/functional/home_controller_test.rb @@ -17,10 +17,6 @@ class HomeControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new end - def test_local_files_reference - assert_local_files_reference - 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 6404e3a..1803b98 100644 --- a/test/functional/manage_products_controller_test.rb +++ b/test/functional/manage_products_controller_test.rb @@ -18,10 +18,6 @@ class ManageProductsControllerTest < ActionController::TestCase login_as :test_user end - def test_local_files_reference - assert_local_files_reference :get, :index, :profile => @enterprise.identifier - 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 a617e11..dbaa697 100644 --- a/test/functional/memberships_controller_test.rb +++ b/test/functional/memberships_controller_test.rb @@ -19,10 +19,6 @@ class MembershipsControllerTest < ActionController::TestCase end attr_reader :profile - def test_local_files_reference - assert_local_files_reference :get, :index, :profile => profile.identifier - 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 87c33fc..91776f0 100644 --- a/test/functional/my_profile_controller_test.rb +++ b/test/functional/my_profile_controller_test.rb @@ -20,12 +20,6 @@ class MyProfileControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new end - def test_local_files_reference - @controller = OnlyForPersonTestController.new - user = create_user('test_user').person - assert_local_files_reference :get, :index, :profile => user.identifier - 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 2c53ed9..37a1f9e 100644 --- a/test/functional/plugins_controller_test.rb +++ b/test/functional/plugins_controller_test.rb @@ -16,10 +16,6 @@ class PluginsControllerTest < ActionController::TestCase end attr_reader :environment - def test_local_files_reference - assert_local_files_reference - 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 04b0012..ca54a6c 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -11,10 +11,6 @@ class ProfileControllerTest < ActionController::TestCase end attr_reader :profile - def test_local_files_reference - assert_local_files_reference - 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 f58b3d4..010aaa9 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -75,10 +75,6 @@ class ProfileDesignControllerTest < ActionController::TestCase end attr_reader :profile - def test_local_files_reference - assert_local_files_reference :get, :index, :profile => 'designtestuser' - 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 2125b99..854dcea 100644 --- a/test/functional/profile_editor_controller_test.rb +++ b/test/functional/profile_editor_controller_test.rb @@ -17,10 +17,6 @@ class ProfileEditorControllerTest < ActionController::TestCase end attr_reader :profile - def test_local_files_reference - assert_local_files_reference :get, :index, :profile => profile.identifier - 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 86838a9..4f10269 100644 --- a/test/functional/profile_members_controller_test.rb +++ b/test/functional/profile_members_controller_test.rb @@ -12,11 +12,6 @@ class ProfileMembersControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new end - def test_local_files_reference - user = create_user('test_user').person - assert_local_files_reference :get, :index, :profile => user.identifier - 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 a5cc544..abdf0aa 100644 --- a/test/functional/region_validators_controller_test.rb +++ b/test/functional/region_validators_controller_test.rb @@ -12,10 +12,6 @@ class RegionValidatorsControllerTest < ActionController::TestCase @response = ActionController::TestResponse.new login_as('ze') end - - def test_local_files_reference - assert_local_files_reference - end # Replace this with your real tests. should 'list regions at index' do diff --git a/test/functional/role_controller_test.rb b/test/functional/role_controller_test.rb index c1156b8..b343b60 100644 --- a/test/functional/role_controller_test.rb +++ b/test/functional/role_controller_test.rb @@ -15,10 +15,6 @@ class RoleControllerTest < ActionController::TestCase login_as(:ze) end - def test_local_files_reference - assert_local_files_reference - 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 f28d016..61a97a7 100644 --- a/test/functional/search_controller_test.rb +++ b/test/functional/search_controller_test.rb @@ -45,10 +45,6 @@ class SearchControllerTest < ActionController::TestCase fast_create(klass, { :name => name }.merge(data), :search => true, :category => category) end - def test_local_files_reference - assert_local_files_reference - 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 5cdfc52..3517bba 100644 --- a/test/functional/tasks_controller_test.rb +++ b/test/functional/tasks_controller_test.rb @@ -22,10 +22,6 @@ class TasksControllerTest < ActionController::TestCase super({ :controller => 'tasks', :profile => profile.identifier }.merge(options)) end - def test_local_files_reference - assert_local_files_reference - end - should 'list pending tasks' do get :index diff --git a/test/test_helper.rb b/test/test_helper.rb index d574773..b9c3f9c 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -110,39 +110,6 @@ class ActiveSupport::TestCase assert_equal parent, child.superclass, "Class #{child} expected to be a subclass of #{parent}" end - def assert_local_files_reference(method=:get, action=:index, params = {}) - if method.to_s() == 'post' - post action, params - else - get action, params - end - doc = Hpricot @response.body - - # Test style references: - (doc/'style').each do |s| - s = s.to_s().gsub( /\/\*.*\*\//, '' ). - split( /;|<|>|\n/ ). - map do |l| - patch = l.match( /@import url\((.*)\)/ ) - patch ? patch[1] : nil - end.compact - s.each do |css_ref| - if ! File.exists?(File.join(Rails.root, 'public', css_ref)) - flunk 'CSS reference missed on HTML: "%s"' % css_ref - end - end - end - - # Test image references: - (doc/'img').each do |img| - src = img.get_attribute( 'src' ).gsub(/\?[0-9]+$/, '') - if ! File.exists?(File.join(Rails.root, 'public', src)) - flunk 'Image reference missed on HTML: "%s"' % src - end - end - - end - # this check only if text has html tag def assert_sanitized(text) assert !text.index('<'), "Text '#{text}' expected to be sanitized" -- libgit2 0.21.2