Commit a20452cdf0df6b1e7b0dddbcadaa2cf68bc60ec0

Authored by Leandro Santos
1 parent 01efcccd

removing assert_local_files_reference from test helper and its references. These…

… tests does not make sense
test/functional/account_controller_test.rb
... ... @@ -21,10 +21,6 @@ class AccountControllerTest < ActionController::TestCase
21 21 disable_signup_bot_check
22 22 end
23 23  
24   - def test_local_files_reference
25   - assert_local_files_reference
26   - end
27   -
28 24 def test_should_login_and_redirect
29 25 post :login, :user => {:login => 'johndoe', :password => 'test'}
30 26 assert session[:user]
... ...
test/functional/admin_panel_controller_test.rb
... ... @@ -14,10 +14,6 @@ class AdminPanelControllerTest < ActionController::TestCase
14 14 login_as(create_admin_user(Environment.default))
15 15 end
16 16  
17   - def test_local_files_reference
18   - assert_local_files_reference
19   - end
20   -
21 17 should 'manage the correct environment' do
22 18 current = fast_create(Environment, :name => 'test environment', :is_default => false)
23 19 current.domains.create!(:name => 'example.com')
... ...
test/functional/application_controller_test.rb
... ... @@ -60,10 +60,6 @@ class ApplicationControllerTest < ActionController::TestCase
60 60 end
61 61  
62 62  
63   - def test_local_files_reference
64   - assert_local_files_reference
65   - end
66   -
67 63 def test_exist_environment_variable_to_helper_environment_identification
68 64 get :index
69 65 assert_not_nil assigns(:environment)
... ...
test/functional/catalog_controller_test.rb
... ... @@ -16,10 +16,6 @@ class CatalogControllerTest < ActionController::TestCase
16 16 end
17 17 attr_accessor :enterprise
18 18  
19   - def test_local_files_reference
20   - assert_local_files_reference :get, :index, :profile => @enterprise.identifier
21   - end
22   -
23 19 should 'not display for non-enterprises' do
24 20 u = create_user('testinguser').person
25 21 get :index, :profile => 'testinguser'
... ...
test/functional/categories_controller_test.rb
... ... @@ -20,10 +20,6 @@ class CategoriesControllerTest < ActionController::TestCase
20 20  
21 21 attr_reader :env, :cat1, :cat2
22 22  
23   - def test_local_files_reference
24   - assert_local_files_reference
25   - end
26   -
27 23 def test_index
28 24 login_as(create_admin_user(Environment.default))
29 25 get :index
... ...
test/functional/cms_controller_test.rb
... ... @@ -18,10 +18,6 @@ class CmsControllerTest < ActionController::TestCase
18 18  
19 19 attr_reader :profile
20 20  
21   - def test_local_files_reference
22   - assert_local_files_reference :get, :index, :profile => profile.identifier
23   - end
24   -
25 21 should 'list top level documents on index' do
26 22 get :index, :profile => profile.identifier
27 23  
... ...
test/functional/content_viewer_controller_test.rb
... ... @@ -18,12 +18,6 @@ class ContentViewerControllerTest < ActionController::TestCase
18 18 end
19 19 attr_reader :profile, :environment
20 20  
21   - def test_local_files_reference
22   - page = profile.articles.build(:name => 'test')
23   - page.save!
24   - assert_local_files_reference :get, :view_page, :profile => profile.identifier, :page => [ 'test' ]
25   - end
26   -
27 21 def test_should_display_page
28 22 page = profile.articles.build(:name => 'test')
29 23 page.save!
... ...
test/functional/edit_template_controller_test.rb
... ... @@ -15,10 +15,6 @@ class EditTemplateControllerTest < ActionController::TestCase
15 15 login_as 'ze'
16 16 end
17 17  
18   - def test_local_files_reference
19   - assert_local_files_reference
20   - end
21   -
22 18 def test_redirect_to_design_editor_when_index_action_is_called
23 19 give_permission('ze', 'edit_environment_design', Environment.default)
24 20 get :index
... ...
test/functional/enterprise_registration_controller_test.rb
... ... @@ -17,10 +17,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase
17 17 login_as 'ze'
18 18 end
19 19  
20   - def test_local_files_reference
21   - assert_local_files_reference
22   - end
23   -
24 20 should 'go to the first step on index' do
25 21 get :index
26 22 assert_response :success
... ...
test/functional/enterprise_validation_controller_test.rb
... ... @@ -19,10 +19,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase
19 19 Profile.expects(:find_by_identifier).with('myorg').returns(@org).at_least_once
20 20 end
21 21  
22   - def test_local_files_reference
23   - assert_local_files_reference :get, :index, :profile => 'myorg'
24   - end
25   -
26 22 should 'list pending validations on index' do
27 23 empty = []
28 24 @org.expects(:pending_validations).returns(empty)
... ...
test/functional/environment_design_controller_test.rb
... ... @@ -17,10 +17,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase
17 17 Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([])
18 18 end
19 19  
20   - def test_local_files_reference
21   - assert_local_files_reference
22   - end
23   -
24 20 should 'indicate only actual blocks as such' do
25 21 assert(@controller.available_blocks.all? {|item| item.new.is_a? Block})
26 22 end
... ...
test/functional/environment_role_manager_controller_test.rb
... ... @@ -11,8 +11,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase
11 11 @response = ActionController::TestResponse.new
12 12 end
13 13  
14   - def test_local_files_reference
15   - assert_local_files_reference
16   - end
17   -
18 14 end
... ...
test/functional/favorite_enterprises_controller_test.rb
... ... @@ -18,10 +18,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase
18 18 end
19 19 attr_accessor :profile, :favorite_enterprise
20 20  
21   - def test_local_files_reference
22   - assert_local_files_reference
23   - end
24   -
25 21 should 'list favorite enterprises' do
26 22 get :index
27 23 assert_response :success
... ...
test/functional/features_controller_test.rb
... ... @@ -14,10 +14,6 @@ class FeaturesControllerTest < ActionController::TestCase
14 14 login_as(create_admin_user(Environment.find(2)))
15 15 end
16 16  
17   - def test_local_files_reference
18   - assert_local_files_reference
19   - end
20   -
21 17 def test_listing_features
22 18 uses_host 'anhetegua.net'
23 19 get :index
... ...
test/functional/friends_controller_test.rb
... ... @@ -18,10 +18,6 @@ class FriendsControllerTest < ActionController::TestCase
18 18 end
19 19 attr_accessor :profile, :friend
20 20  
21   - def test_local_files_reference
22   - assert_local_files_reference
23   - end
24   -
25 21 should 'list friends' do
26 22 get :index
27 23 assert_response :success
... ...
test/functional/home_controller_test.rb
... ... @@ -17,10 +17,6 @@ class HomeControllerTest < ActionController::TestCase
17 17 @response = ActionController::TestResponse.new
18 18 end
19 19  
20   - def test_local_files_reference
21   - assert_local_files_reference
22   - end
23   -
24 20 should 'not display news from portal if disabled in environment' do
25 21 env = Environment.default
26 22 env.disable('use_portal_community')
... ...
test/functional/manage_products_controller_test.rb
... ... @@ -18,10 +18,6 @@ class ManageProductsControllerTest < ActionController::TestCase
18 18 login_as :test_user
19 19 end
20 20  
21   - def test_local_files_reference
22   - assert_local_files_reference :get, :index, :profile => @enterprise.identifier
23   - end
24   -
25 21 should "not have permission" do
26 22 u = create_user('user_test')
27 23 login_as :user_test
... ...
test/functional/memberships_controller_test.rb
... ... @@ -19,10 +19,6 @@ class MembershipsControllerTest < ActionController::TestCase
19 19 end
20 20 attr_reader :profile
21 21  
22   - def test_local_files_reference
23   - assert_local_files_reference :get, :index, :profile => profile.identifier
24   - end
25   -
26 22 should 'list current memberships' do
27 23 get :index, :profile => profile.identifier
28 24  
... ...
test/functional/my_profile_controller_test.rb
... ... @@ -20,12 +20,6 @@ class MyProfileControllerTest < ActionController::TestCase
20 20 @response = ActionController::TestResponse.new
21 21 end
22 22  
23   - def test_local_files_reference
24   - @controller = OnlyForPersonTestController.new
25   - user = create_user('test_user').person
26   - assert_local_files_reference :get, :index, :profile => user.identifier
27   - end
28   -
29 23 def test_should_allow_person
30 24 @controller = OnlyForPersonTestController.new
31 25 person = create_user('random_joe')
... ...
test/functional/plugins_controller_test.rb
... ... @@ -16,10 +16,6 @@ class PluginsControllerTest < ActionController::TestCase
16 16 end
17 17 attr_reader :environment
18 18  
19   - def test_local_files_reference
20   - assert_local_files_reference
21   - end
22   -
23 19 should 'list system active plugins' do
24 20 class Plugin1 < Noosfero::Plugin
25 21 class << self
... ...
test/functional/profile_controller_test.rb
... ... @@ -11,10 +11,6 @@ class ProfileControllerTest &lt; ActionController::TestCase
11 11 end
12 12 attr_reader :profile
13 13  
14   - def test_local_files_reference
15   - assert_local_files_reference
16   - end
17   -
18 14 noosfero_test :profile => 'testuser'
19 15  
20 16 should 'list friends' do
... ...
test/functional/profile_design_controller_test.rb
... ... @@ -75,10 +75,6 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
75 75 end
76 76 attr_reader :profile
77 77  
78   - def test_local_files_reference
79   - assert_local_files_reference :get, :index, :profile => 'designtestuser'
80   - end
81   -
82 78 ######################################################
83 79 # BEGIN - tests for BoxOrganizerController features
84 80 ######################################################
... ...
test/functional/profile_editor_controller_test.rb
... ... @@ -17,10 +17,6 @@ class ProfileEditorControllerTest &lt; ActionController::TestCase
17 17 end
18 18 attr_reader :profile
19 19  
20   - def test_local_files_reference
21   - assert_local_files_reference :get, :index, :profile => profile.identifier
22   - end
23   -
24 20 def test_index
25 21 get :index, :profile => profile.identifier
26 22 assert_template 'index'
... ...
test/functional/profile_members_controller_test.rb
... ... @@ -12,11 +12,6 @@ class ProfileMembersControllerTest &lt; ActionController::TestCase
12 12 @response = ActionController::TestResponse.new
13 13 end
14 14  
15   - def test_local_files_reference
16   - user = create_user('test_user').person
17   - assert_local_files_reference :get, :index, :profile => user.identifier
18   - end
19   -
20 15 should 'not access index if dont have permission' do
21 16 user = create_user('test_user')
22 17 fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'test enterprise')
... ...
test/functional/region_validators_controller_test.rb
... ... @@ -12,10 +12,6 @@ class RegionValidatorsControllerTest &lt; ActionController::TestCase
12 12 @response = ActionController::TestResponse.new
13 13 login_as('ze')
14 14 end
15   -
16   - def test_local_files_reference
17   - assert_local_files_reference
18   - end
19 15  
20 16 # Replace this with your real tests.
21 17 should 'list regions at index' do
... ...
test/functional/role_controller_test.rb
... ... @@ -15,10 +15,6 @@ class RoleControllerTest &lt; ActionController::TestCase
15 15 login_as(:ze)
16 16 end
17 17  
18   - def test_local_files_reference
19   - assert_local_files_reference
20   - end
21   -
22 18 def test_index_should_get_roles
23 19 get 'index'
24 20 assert_response :success
... ...
test/functional/search_controller_test.rb
... ... @@ -45,10 +45,6 @@ class SearchControllerTest &lt; ActionController::TestCase
45 45 fast_create(klass, { :name => name }.merge(data), :search => true, :category => category)
46 46 end
47 47  
48   - def test_local_files_reference
49   - assert_local_files_reference
50   - end
51   -
52 48 should 'espape xss attack' do
53 49 get 'index', :query => '<wslite>'
54 50 assert_no_tag :tag => 'wslite'
... ...
test/functional/tasks_controller_test.rb
... ... @@ -22,10 +22,6 @@ class TasksControllerTest &lt; ActionController::TestCase
22 22 super({ :controller => 'tasks', :profile => profile.identifier }.merge(options))
23 23 end
24 24  
25   - def test_local_files_reference
26   - assert_local_files_reference
27   - end
28   -
29 25 should 'list pending tasks' do
30 26 get :index
31 27  
... ...
test/test_helper.rb
... ... @@ -110,39 +110,6 @@ class ActiveSupport::TestCase
110 110 assert_equal parent, child.superclass, "Class #{child} expected to be a subclass of #{parent}"
111 111 end
112 112  
113   - def assert_local_files_reference(method=:get, action=:index, params = {})
114   - if method.to_s() == 'post'
115   - post action, params
116   - else
117   - get action, params
118   - end
119   - doc = Hpricot @response.body
120   -
121   - # Test style references:
122   - (doc/'style').each do |s|
123   - s = s.to_s().gsub( /\/\*.*\*\//, '' ).
124   - split( /;|<|>|\n/ ).
125   - map do |l|
126   - patch = l.match( /@import url\((.*)\)/ )
127   - patch ? patch[1] : nil
128   - end.compact
129   - s.each do |css_ref|
130   - if ! File.exists?(File.join(Rails.root, 'public', css_ref))
131   - flunk 'CSS reference missed on HTML: "%s"' % css_ref
132   - end
133   - end
134   - end
135   -
136   - # Test image references:
137   - (doc/'img').each do |img|
138   - src = img.get_attribute( 'src' ).gsub(/\?[0-9]+$/, '')
139   - if ! File.exists?(File.join(Rails.root, 'public', src))
140   - flunk 'Image reference missed on HTML: "%s"' % src
141   - end
142   - end
143   -
144   - end
145   -
146 113 # this check only if text has html tag
147 114 def assert_sanitized(text)
148 115 assert !text.index('<'), "Text '#{text}' expected to be sanitized"
... ...