Commit a20452cdf0df6b1e7b0dddbcadaa2cf68bc60ec0
1 parent
01efcccd
Exists in
master
and in
27 other branches
removing assert_local_files_reference from test helper and its references. These…
… tests does not make sense
Showing
29 changed files
with
0 additions
and
150 deletions
Show diff stats
test/functional/account_controller_test.rb
@@ -21,10 +21,6 @@ class AccountControllerTest < ActionController::TestCase | @@ -21,10 +21,6 @@ class AccountControllerTest < ActionController::TestCase | ||
21 | disable_signup_bot_check | 21 | disable_signup_bot_check |
22 | end | 22 | end |
23 | 23 | ||
24 | - def test_local_files_reference | ||
25 | - assert_local_files_reference | ||
26 | - end | ||
27 | - | ||
28 | def test_should_login_and_redirect | 24 | def test_should_login_and_redirect |
29 | post :login, :user => {:login => 'johndoe', :password => 'test'} | 25 | post :login, :user => {:login => 'johndoe', :password => 'test'} |
30 | assert session[:user] | 26 | assert session[:user] |
test/functional/admin_panel_controller_test.rb
@@ -14,10 +14,6 @@ class AdminPanelControllerTest < ActionController::TestCase | @@ -14,10 +14,6 @@ class AdminPanelControllerTest < ActionController::TestCase | ||
14 | login_as(create_admin_user(Environment.default)) | 14 | login_as(create_admin_user(Environment.default)) |
15 | end | 15 | end |
16 | 16 | ||
17 | - def test_local_files_reference | ||
18 | - assert_local_files_reference | ||
19 | - end | ||
20 | - | ||
21 | should 'manage the correct environment' do | 17 | should 'manage the correct environment' do |
22 | current = fast_create(Environment, :name => 'test environment', :is_default => false) | 18 | current = fast_create(Environment, :name => 'test environment', :is_default => false) |
23 | current.domains.create!(:name => 'example.com') | 19 | current.domains.create!(:name => 'example.com') |
test/functional/application_controller_test.rb
@@ -60,10 +60,6 @@ class ApplicationControllerTest < ActionController::TestCase | @@ -60,10 +60,6 @@ class ApplicationControllerTest < ActionController::TestCase | ||
60 | end | 60 | end |
61 | 61 | ||
62 | 62 | ||
63 | - def test_local_files_reference | ||
64 | - assert_local_files_reference | ||
65 | - end | ||
66 | - | ||
67 | def test_exist_environment_variable_to_helper_environment_identification | 63 | def test_exist_environment_variable_to_helper_environment_identification |
68 | get :index | 64 | get :index |
69 | assert_not_nil assigns(:environment) | 65 | assert_not_nil assigns(:environment) |
test/functional/catalog_controller_test.rb
@@ -16,10 +16,6 @@ class CatalogControllerTest < ActionController::TestCase | @@ -16,10 +16,6 @@ class CatalogControllerTest < ActionController::TestCase | ||
16 | end | 16 | end |
17 | attr_accessor :enterprise | 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 | should 'not display for non-enterprises' do | 19 | should 'not display for non-enterprises' do |
24 | u = create_user('testinguser').person | 20 | u = create_user('testinguser').person |
25 | get :index, :profile => 'testinguser' | 21 | get :index, :profile => 'testinguser' |
test/functional/categories_controller_test.rb
@@ -20,10 +20,6 @@ class CategoriesControllerTest < ActionController::TestCase | @@ -20,10 +20,6 @@ class CategoriesControllerTest < ActionController::TestCase | ||
20 | 20 | ||
21 | attr_reader :env, :cat1, :cat2 | 21 | attr_reader :env, :cat1, :cat2 |
22 | 22 | ||
23 | - def test_local_files_reference | ||
24 | - assert_local_files_reference | ||
25 | - end | ||
26 | - | ||
27 | def test_index | 23 | def test_index |
28 | login_as(create_admin_user(Environment.default)) | 24 | login_as(create_admin_user(Environment.default)) |
29 | get :index | 25 | get :index |
test/functional/cms_controller_test.rb
@@ -18,10 +18,6 @@ class CmsControllerTest < ActionController::TestCase | @@ -18,10 +18,6 @@ class CmsControllerTest < ActionController::TestCase | ||
18 | 18 | ||
19 | attr_reader :profile | 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 | should 'list top level documents on index' do | 21 | should 'list top level documents on index' do |
26 | get :index, :profile => profile.identifier | 22 | get :index, :profile => profile.identifier |
27 | 23 |
test/functional/content_viewer_controller_test.rb
@@ -18,12 +18,6 @@ class ContentViewerControllerTest < ActionController::TestCase | @@ -18,12 +18,6 @@ class ContentViewerControllerTest < ActionController::TestCase | ||
18 | end | 18 | end |
19 | attr_reader :profile, :environment | 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 | def test_should_display_page | 21 | def test_should_display_page |
28 | page = profile.articles.build(:name => 'test') | 22 | page = profile.articles.build(:name => 'test') |
29 | page.save! | 23 | page.save! |
test/functional/edit_template_controller_test.rb
@@ -15,10 +15,6 @@ class EditTemplateControllerTest < ActionController::TestCase | @@ -15,10 +15,6 @@ class EditTemplateControllerTest < ActionController::TestCase | ||
15 | login_as 'ze' | 15 | login_as 'ze' |
16 | end | 16 | end |
17 | 17 | ||
18 | - def test_local_files_reference | ||
19 | - assert_local_files_reference | ||
20 | - end | ||
21 | - | ||
22 | def test_redirect_to_design_editor_when_index_action_is_called | 18 | def test_redirect_to_design_editor_when_index_action_is_called |
23 | give_permission('ze', 'edit_environment_design', Environment.default) | 19 | give_permission('ze', 'edit_environment_design', Environment.default) |
24 | get :index | 20 | get :index |
test/functional/enterprise_registration_controller_test.rb
@@ -17,10 +17,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase | @@ -17,10 +17,6 @@ class EnterpriseRegistrationControllerTest < ActionController::TestCase | ||
17 | login_as 'ze' | 17 | login_as 'ze' |
18 | end | 18 | end |
19 | 19 | ||
20 | - def test_local_files_reference | ||
21 | - assert_local_files_reference | ||
22 | - end | ||
23 | - | ||
24 | should 'go to the first step on index' do | 20 | should 'go to the first step on index' do |
25 | get :index | 21 | get :index |
26 | assert_response :success | 22 | assert_response :success |
test/functional/enterprise_validation_controller_test.rb
@@ -19,10 +19,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase | @@ -19,10 +19,6 @@ class EnterpriseValidationControllerTest < ActionController::TestCase | ||
19 | Profile.expects(:find_by_identifier).with('myorg').returns(@org).at_least_once | 19 | Profile.expects(:find_by_identifier).with('myorg').returns(@org).at_least_once |
20 | end | 20 | end |
21 | 21 | ||
22 | - def test_local_files_reference | ||
23 | - assert_local_files_reference :get, :index, :profile => 'myorg' | ||
24 | - end | ||
25 | - | ||
26 | should 'list pending validations on index' do | 22 | should 'list pending validations on index' do |
27 | empty = [] | 23 | empty = [] |
28 | @org.expects(:pending_validations).returns(empty) | 24 | @org.expects(:pending_validations).returns(empty) |
test/functional/environment_design_controller_test.rb
@@ -17,10 +17,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | @@ -17,10 +17,6 @@ class EnvironmentDesignControllerTest < ActionController::TestCase | ||
17 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) | 17 | Noosfero::Plugin::Manager.any_instance.stubs(:enabled_plugins).returns([]) |
18 | end | 18 | end |
19 | 19 | ||
20 | - def test_local_files_reference | ||
21 | - assert_local_files_reference | ||
22 | - end | ||
23 | - | ||
24 | should 'indicate only actual blocks as such' do | 20 | should 'indicate only actual blocks as such' do |
25 | assert(@controller.available_blocks.all? {|item| item.new.is_a? Block}) | 21 | assert(@controller.available_blocks.all? {|item| item.new.is_a? Block}) |
26 | end | 22 | end |
test/functional/environment_role_manager_controller_test.rb
@@ -11,8 +11,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase | @@ -11,8 +11,4 @@ class EnvironmentRoleManagerControllerTest < ActionController::TestCase | ||
11 | @response = ActionController::TestResponse.new | 11 | @response = ActionController::TestResponse.new |
12 | end | 12 | end |
13 | 13 | ||
14 | - def test_local_files_reference | ||
15 | - assert_local_files_reference | ||
16 | - end | ||
17 | - | ||
18 | end | 14 | end |
test/functional/favorite_enterprises_controller_test.rb
@@ -18,10 +18,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase | @@ -18,10 +18,6 @@ class FavoriteEnterprisesControllerTest < ActionController::TestCase | ||
18 | end | 18 | end |
19 | attr_accessor :profile, :favorite_enterprise | 19 | attr_accessor :profile, :favorite_enterprise |
20 | 20 | ||
21 | - def test_local_files_reference | ||
22 | - assert_local_files_reference | ||
23 | - end | ||
24 | - | ||
25 | should 'list favorite enterprises' do | 21 | should 'list favorite enterprises' do |
26 | get :index | 22 | get :index |
27 | assert_response :success | 23 | assert_response :success |
test/functional/features_controller_test.rb
@@ -14,10 +14,6 @@ class FeaturesControllerTest < ActionController::TestCase | @@ -14,10 +14,6 @@ class FeaturesControllerTest < ActionController::TestCase | ||
14 | login_as(create_admin_user(Environment.find(2))) | 14 | login_as(create_admin_user(Environment.find(2))) |
15 | end | 15 | end |
16 | 16 | ||
17 | - def test_local_files_reference | ||
18 | - assert_local_files_reference | ||
19 | - end | ||
20 | - | ||
21 | def test_listing_features | 17 | def test_listing_features |
22 | uses_host 'anhetegua.net' | 18 | uses_host 'anhetegua.net' |
23 | get :index | 19 | get :index |
test/functional/friends_controller_test.rb
@@ -18,10 +18,6 @@ class FriendsControllerTest < ActionController::TestCase | @@ -18,10 +18,6 @@ class FriendsControllerTest < ActionController::TestCase | ||
18 | end | 18 | end |
19 | attr_accessor :profile, :friend | 19 | attr_accessor :profile, :friend |
20 | 20 | ||
21 | - def test_local_files_reference | ||
22 | - assert_local_files_reference | ||
23 | - end | ||
24 | - | ||
25 | should 'list friends' do | 21 | should 'list friends' do |
26 | get :index | 22 | get :index |
27 | assert_response :success | 23 | assert_response :success |
test/functional/home_controller_test.rb
@@ -17,10 +17,6 @@ class HomeControllerTest < ActionController::TestCase | @@ -17,10 +17,6 @@ class HomeControllerTest < ActionController::TestCase | ||
17 | @response = ActionController::TestResponse.new | 17 | @response = ActionController::TestResponse.new |
18 | end | 18 | end |
19 | 19 | ||
20 | - def test_local_files_reference | ||
21 | - assert_local_files_reference | ||
22 | - end | ||
23 | - | ||
24 | should 'not display news from portal if disabled in environment' do | 20 | should 'not display news from portal if disabled in environment' do |
25 | env = Environment.default | 21 | env = Environment.default |
26 | env.disable('use_portal_community') | 22 | env.disable('use_portal_community') |
test/functional/manage_products_controller_test.rb
@@ -18,10 +18,6 @@ class ManageProductsControllerTest < ActionController::TestCase | @@ -18,10 +18,6 @@ class ManageProductsControllerTest < ActionController::TestCase | ||
18 | login_as :test_user | 18 | login_as :test_user |
19 | end | 19 | end |
20 | 20 | ||
21 | - def test_local_files_reference | ||
22 | - assert_local_files_reference :get, :index, :profile => @enterprise.identifier | ||
23 | - end | ||
24 | - | ||
25 | should "not have permission" do | 21 | should "not have permission" do |
26 | u = create_user('user_test') | 22 | u = create_user('user_test') |
27 | login_as :user_test | 23 | login_as :user_test |
test/functional/memberships_controller_test.rb
@@ -19,10 +19,6 @@ class MembershipsControllerTest < ActionController::TestCase | @@ -19,10 +19,6 @@ class MembershipsControllerTest < ActionController::TestCase | ||
19 | end | 19 | end |
20 | attr_reader :profile | 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 | should 'list current memberships' do | 22 | should 'list current memberships' do |
27 | get :index, :profile => profile.identifier | 23 | get :index, :profile => profile.identifier |
28 | 24 |
test/functional/my_profile_controller_test.rb
@@ -20,12 +20,6 @@ class MyProfileControllerTest < ActionController::TestCase | @@ -20,12 +20,6 @@ class MyProfileControllerTest < ActionController::TestCase | ||
20 | @response = ActionController::TestResponse.new | 20 | @response = ActionController::TestResponse.new |
21 | end | 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 | def test_should_allow_person | 23 | def test_should_allow_person |
30 | @controller = OnlyForPersonTestController.new | 24 | @controller = OnlyForPersonTestController.new |
31 | person = create_user('random_joe') | 25 | person = create_user('random_joe') |
test/functional/plugins_controller_test.rb
@@ -16,10 +16,6 @@ class PluginsControllerTest < ActionController::TestCase | @@ -16,10 +16,6 @@ class PluginsControllerTest < ActionController::TestCase | ||
16 | end | 16 | end |
17 | attr_reader :environment | 17 | attr_reader :environment |
18 | 18 | ||
19 | - def test_local_files_reference | ||
20 | - assert_local_files_reference | ||
21 | - end | ||
22 | - | ||
23 | should 'list system active plugins' do | 19 | should 'list system active plugins' do |
24 | class Plugin1 < Noosfero::Plugin | 20 | class Plugin1 < Noosfero::Plugin |
25 | class << self | 21 | class << self |
test/functional/profile_controller_test.rb
@@ -11,10 +11,6 @@ class ProfileControllerTest < ActionController::TestCase | @@ -11,10 +11,6 @@ class ProfileControllerTest < ActionController::TestCase | ||
11 | end | 11 | end |
12 | attr_reader :profile | 12 | attr_reader :profile |
13 | 13 | ||
14 | - def test_local_files_reference | ||
15 | - assert_local_files_reference | ||
16 | - end | ||
17 | - | ||
18 | noosfero_test :profile => 'testuser' | 14 | noosfero_test :profile => 'testuser' |
19 | 15 | ||
20 | should 'list friends' do | 16 | should 'list friends' do |
test/functional/profile_design_controller_test.rb
@@ -75,10 +75,6 @@ class ProfileDesignControllerTest < ActionController::TestCase | @@ -75,10 +75,6 @@ class ProfileDesignControllerTest < ActionController::TestCase | ||
75 | end | 75 | end |
76 | attr_reader :profile | 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 | # BEGIN - tests for BoxOrganizerController features | 79 | # BEGIN - tests for BoxOrganizerController features |
84 | ###################################################### | 80 | ###################################################### |
test/functional/profile_editor_controller_test.rb
@@ -17,10 +17,6 @@ class ProfileEditorControllerTest < ActionController::TestCase | @@ -17,10 +17,6 @@ class ProfileEditorControllerTest < ActionController::TestCase | ||
17 | end | 17 | end |
18 | attr_reader :profile | 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 | def test_index | 20 | def test_index |
25 | get :index, :profile => profile.identifier | 21 | get :index, :profile => profile.identifier |
26 | assert_template 'index' | 22 | assert_template 'index' |
test/functional/profile_members_controller_test.rb
@@ -12,11 +12,6 @@ class ProfileMembersControllerTest < ActionController::TestCase | @@ -12,11 +12,6 @@ class ProfileMembersControllerTest < ActionController::TestCase | ||
12 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
13 | end | 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 | should 'not access index if dont have permission' do | 15 | should 'not access index if dont have permission' do |
21 | user = create_user('test_user') | 16 | user = create_user('test_user') |
22 | fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'test enterprise') | 17 | fast_create(Enterprise, :identifier => 'test_enterprise', :name => 'test enterprise') |
test/functional/region_validators_controller_test.rb
@@ -12,10 +12,6 @@ class RegionValidatorsControllerTest < ActionController::TestCase | @@ -12,10 +12,6 @@ class RegionValidatorsControllerTest < ActionController::TestCase | ||
12 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
13 | login_as('ze') | 13 | login_as('ze') |
14 | end | 14 | end |
15 | - | ||
16 | - def test_local_files_reference | ||
17 | - assert_local_files_reference | ||
18 | - end | ||
19 | 15 | ||
20 | # Replace this with your real tests. | 16 | # Replace this with your real tests. |
21 | should 'list regions at index' do | 17 | should 'list regions at index' do |
test/functional/role_controller_test.rb
@@ -15,10 +15,6 @@ class RoleControllerTest < ActionController::TestCase | @@ -15,10 +15,6 @@ class RoleControllerTest < ActionController::TestCase | ||
15 | login_as(:ze) | 15 | login_as(:ze) |
16 | end | 16 | end |
17 | 17 | ||
18 | - def test_local_files_reference | ||
19 | - assert_local_files_reference | ||
20 | - end | ||
21 | - | ||
22 | def test_index_should_get_roles | 18 | def test_index_should_get_roles |
23 | get 'index' | 19 | get 'index' |
24 | assert_response :success | 20 | assert_response :success |
test/functional/search_controller_test.rb
@@ -45,10 +45,6 @@ class SearchControllerTest < ActionController::TestCase | @@ -45,10 +45,6 @@ class SearchControllerTest < ActionController::TestCase | ||
45 | fast_create(klass, { :name => name }.merge(data), :search => true, :category => category) | 45 | fast_create(klass, { :name => name }.merge(data), :search => true, :category => category) |
46 | end | 46 | end |
47 | 47 | ||
48 | - def test_local_files_reference | ||
49 | - assert_local_files_reference | ||
50 | - end | ||
51 | - | ||
52 | should 'espape xss attack' do | 48 | should 'espape xss attack' do |
53 | get 'index', :query => '<wslite>' | 49 | get 'index', :query => '<wslite>' |
54 | assert_no_tag :tag => 'wslite' | 50 | assert_no_tag :tag => 'wslite' |
test/functional/tasks_controller_test.rb
@@ -22,10 +22,6 @@ class TasksControllerTest < ActionController::TestCase | @@ -22,10 +22,6 @@ class TasksControllerTest < ActionController::TestCase | ||
22 | super({ :controller => 'tasks', :profile => profile.identifier }.merge(options)) | 22 | super({ :controller => 'tasks', :profile => profile.identifier }.merge(options)) |
23 | end | 23 | end |
24 | 24 | ||
25 | - def test_local_files_reference | ||
26 | - assert_local_files_reference | ||
27 | - end | ||
28 | - | ||
29 | should 'list pending tasks' do | 25 | should 'list pending tasks' do |
30 | get :index | 26 | get :index |
31 | 27 |
test/test_helper.rb
@@ -110,39 +110,6 @@ class ActiveSupport::TestCase | @@ -110,39 +110,6 @@ class ActiveSupport::TestCase | ||
110 | 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}" |
111 | end | 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 | # this check only if text has html tag | 113 | # this check only if text has html tag |
147 | def assert_sanitized(text) | 114 | def assert_sanitized(text) |
148 | assert !text.index('<'), "Text '#{text}' expected to be sanitized" | 115 | assert !text.index('<'), "Text '#{text}' expected to be sanitized" |