Commit 83726d732778475083b97339414fdc5caaadf422
1 parent
4488de24
Exists in
master
and in
8 other branches
Remove SSL support
Besides nobody using it, the implementataion is really crappy so we are better without it.
Showing
42 changed files
with
7 additions
and
388 deletions
Show diff stats
app/controllers/admin_controller.rb
app/controllers/application_controller.rb
... | ... | @@ -42,34 +42,6 @@ class ApplicationController < ActionController::Base |
42 | 42 | include AuthenticatedSystem |
43 | 43 | include PermissionCheck |
44 | 44 | |
45 | - def self.require_ssl(*options) | |
46 | - before_filter :check_ssl, *options | |
47 | - end | |
48 | - def check_ssl | |
49 | - return true if (request.ssl? || ENV['RAILS_ENV'] == 'development') | |
50 | - redirect_to_ssl | |
51 | - end | |
52 | - def redirect_to_ssl | |
53 | - if environment.enable_ssl | |
54 | - redirect_to(params.merge(:protocol => 'https://', :host => ssl_hostname)) | |
55 | - true | |
56 | - else | |
57 | - false | |
58 | - end | |
59 | - end | |
60 | - | |
61 | - def self.refuse_ssl(*options) | |
62 | - before_filter :avoid_ssl, *options | |
63 | - end | |
64 | - def avoid_ssl | |
65 | - if (!request.ssl? || ENV['RAILS_ENV'] == 'development') | |
66 | - true | |
67 | - else | |
68 | - redirect_to(params.merge(:protocol => 'http://')) | |
69 | - false | |
70 | - end | |
71 | - end | |
72 | - | |
73 | 45 | before_filter :set_locale |
74 | 46 | def set_locale |
75 | 47 | FastGettext.available_locales = Noosfero.available_locales | ... | ... |
app/controllers/my_profile/cms_controller.rb
... | ... | @@ -23,15 +23,6 @@ class CmsController < MyProfileController |
23 | 23 | profile.articles.find(c.params[:id]).allow_post_content?(user) |
24 | 24 | end |
25 | 25 | |
26 | - alias :check_ssl_orig :check_ssl | |
27 | - # Redefines the SSL checking to avoid requiring SSL when creating the "New | |
28 | - # publication" button on article's public view. | |
29 | - def check_ssl | |
30 | - if ((params[:action] == 'new') && (!request.xhr?)) || (params[:action] != 'new') | |
31 | - check_ssl_orig | |
32 | - end | |
33 | - end | |
34 | - | |
35 | 26 | def boxes_holder |
36 | 27 | profile |
37 | 28 | end |
... | ... | @@ -341,10 +332,6 @@ class CmsController < MyProfileController |
341 | 332 | end |
342 | 333 | end |
343 | 334 | |
344 | - def maybe_ssl(url) | |
345 | - [url, url.sub('https:', 'http:')] | |
346 | - end | |
347 | - | |
348 | 335 | def valid_article_type?(type) |
349 | 336 | (available_article_types + special_article_types).map {|item| item.name}.include?(type) |
350 | 337 | end | ... | ... |
app/controllers/my_profile_controller.rb
app/controllers/public/account_controller.rb
... | ... | @@ -4,7 +4,6 @@ class AccountController < ApplicationController |
4 | 4 | |
5 | 5 | inverse_captcha :field => 'e_mail' |
6 | 6 | |
7 | - require_ssl :except => [ :login_popup, :logout_popup, :profile_details ] | |
8 | 7 | |
9 | 8 | before_filter :login_required, :only => [:activation_question, :accept_terms, :activate_enterprise] |
10 | 9 | before_filter :redirect_if_logged_in, :only => [:login, :signup] | ... | ... |
app/controllers/public/content_viewer_controller.rb
... | ... | @@ -33,14 +33,6 @@ class ContentViewerController < ApplicationController |
33 | 33 | end |
34 | 34 | end |
35 | 35 | |
36 | - if !@page.public? && !request.ssl? | |
37 | - return if redirect_to_ssl | |
38 | - end | |
39 | - | |
40 | - if @page.public? | |
41 | - return unless avoid_ssl | |
42 | - end | |
43 | - | |
44 | 36 | if !@page.display_to?(user) |
45 | 37 | if profile.display_info_to?(user) || !profile.visible? |
46 | 38 | message = _('You are not allowed to view this content. You can contact the owner of this profile to request access then.') | ... | ... |
app/controllers/public/enterprise_registration_controller.rb
app/controllers/public_controller.rb
app/helpers/application_helper.rb
... | ... | @@ -876,18 +876,11 @@ module ApplicationHelper |
876 | 876 | |
877 | 877 | def login_url |
878 | 878 | options = Noosfero.url_options.merge({ :controller => 'account', :action => 'login' }) |
879 | - if environment.enable_ssl && (ENV['RAILS_ENV'] != 'development') | |
880 | - options.merge!(:protocol => 'https://', :host => ssl_hostname) | |
881 | - end | |
882 | 879 | url_for(options) |
883 | 880 | end |
884 | 881 | |
885 | - def ssl_hostname | |
886 | - environment.default_hostname | |
887 | - end | |
888 | - | |
889 | 882 | def base_url |
890 | - environment.top_url(request.ssl?) | |
883 | + environment.top_url | |
891 | 884 | end |
892 | 885 | |
893 | 886 | def helper_for_article(article) | ... | ... |
app/models/environment.rb
... | ... | @@ -208,7 +208,6 @@ class Environment < ActiveRecord::Base |
208 | 208 | settings_items :layout_template, :type => String, :default => 'default' |
209 | 209 | settings_items :homepage, :type => String |
210 | 210 | settings_items :description, :type => String, :default => '<div style="text-align: center"><a href="http://noosfero.org/"><img src="/images/noosfero-network.png" alt="Noosfero"/></a></div>' |
211 | - settings_items :enable_ssl | |
212 | 211 | settings_items :local_docs, :type => Array, :default => [] |
213 | 212 | settings_items :news_amount_by_folder, :type => Integer, :default => 4 |
214 | 213 | settings_items :help_message_to_add_enterprise, :type => String, :default => '' |
... | ... | @@ -526,8 +525,8 @@ class Environment < ActiveRecord::Base |
526 | 525 | end |
527 | 526 | end |
528 | 527 | |
529 | - def top_url(ssl = false) | |
530 | - protocol = (ssl ? 'https' : 'http') | |
528 | + def top_url | |
529 | + protocol = 'http' | |
531 | 530 | result = "#{protocol}://#{default_hostname}" |
532 | 531 | if Noosfero.url_options.has_key?(:port) |
533 | 532 | result << ':' << Noosfero.url_options[:port].to_s | ... | ... |
test/functional/account_controller_test.rb
... | ... | @@ -15,8 +15,6 @@ class AccountControllerTest < Test::Unit::TestCase |
15 | 15 | @controller = AccountController.new |
16 | 16 | @request = ActionController::TestRequest.new |
17 | 17 | @response = ActionController::TestResponse.new |
18 | - | |
19 | - @request.stubs(:ssl?).returns(true) | |
20 | 18 | end |
21 | 19 | |
22 | 20 | def test_local_files_reference |
... | ... | @@ -593,38 +591,6 @@ class AccountControllerTest < Test::Unit::TestCase |
593 | 591 | assert_equal 1, assigns(:user).person.boxes[0].blocks.size |
594 | 592 | end |
595 | 593 | |
596 | - should 'force ssl' do | |
597 | - Environment.default.update_attribute(:enable_ssl, true) | |
598 | - @request.expects(:ssl?).returns(false).at_least_once | |
599 | - get :index | |
600 | - assert_redirected_to :protocol => 'https://' | |
601 | - end | |
602 | - | |
603 | - should 'alllow login_popup without SSL' do | |
604 | - @request.expects(:ssl?).returns(false).at_least_once | |
605 | - get :login_popup | |
606 | - assert_response :success | |
607 | - end | |
608 | - | |
609 | - should 'allow logout_popup without SSL' do | |
610 | - @request.expects(:ssl?).returns(false).at_least_once | |
611 | - get :logout_popup | |
612 | - assert_response :success | |
613 | - end | |
614 | - | |
615 | - should 'point to SSL URL in login popup' do | |
616 | - Environment.default.update_attribute(:enable_ssl, true) | |
617 | - get :login_popup | |
618 | - assert_tag :tag => 'form', :attributes => { :action => /^https:\/\// } | |
619 | - end | |
620 | - | |
621 | - should 'not point to SSL URL in login popup when in development mode' do | |
622 | - @request.stubs(:ssl?).returns(false) | |
623 | - ENV.expects(:[]).with('RAILS_ENV').returns('development').at_least_once | |
624 | - get :login_popup | |
625 | - assert_no_tag :tag => 'form', :attributes => { :action => /^https:\/\// } | |
626 | - end | |
627 | - | |
628 | 594 | should 'render person partial' do |
629 | 595 | Environment.any_instance.expects(:signup_person_fields).returns(['contact_phone']).at_least_once |
630 | 596 | get :signup | ... | ... |
test/functional/admin_controller_test.rb
... | ... | @@ -6,28 +6,8 @@ class AdminController; def rescue_action(e) raise e end; end |
6 | 6 | |
7 | 7 | class AdminControllerTest < Test::Unit::TestCase |
8 | 8 | |
9 | - class AdminTestController < AdminController | |
10 | - def index | |
11 | - render :text => 'ok', :layout => 'application' | |
12 | - end | |
13 | - end | |
14 | - | |
15 | - def setup | |
16 | - @controller = AdminTestController.new | |
17 | - @request = ActionController::TestRequest.new | |
18 | - @response = ActionController::TestResponse.new | |
19 | - end | |
20 | - | |
21 | - should 'require ssl' do | |
22 | - Environment.default.update_attribute(:enable_ssl, true) | |
23 | - get :index | |
24 | - assert_redirected_to :protocol => 'https://' | |
25 | - end | |
26 | - | |
27 | - should 'detect ssl' do | |
28 | - @request.expects(:ssl?).returns(true).at_least_once | |
29 | - get :index | |
30 | - assert_response :success | |
9 | + should 'inherit from ApplicationController' do | |
10 | + assert_kind_of ApplicationController, AdminController.new | |
31 | 11 | end |
32 | 12 | |
33 | 13 | end | ... | ... |
test/functional/admin_panel_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class AdminPanelControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = AdminPanelController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | login_as(create_admin_user(Environment.default)) |
16 | 15 | end | ... | ... |
test/functional/application_controller_test.rb
... | ... | @@ -252,99 +252,6 @@ class ApplicationControllerTest < Test::Unit::TestCase |
252 | 252 | get :index |
253 | 253 | end |
254 | 254 | |
255 | - should 'require ssl when told to' do | |
256 | - Environment.default.update_attribute(:enable_ssl, true) | |
257 | - @request.expects(:ssl?).returns(false).at_least_once | |
258 | - get :sslonly | |
259 | - assert_redirected_to :protocol => 'https://' | |
260 | - end | |
261 | - | |
262 | - should 'not force ssl in development mode' do | |
263 | - ENV.expects(:[]).with('RAILS_ENV').returns('development').at_least_once | |
264 | - @request.expects(:ssl?).returns(false).at_least_once | |
265 | - get :sslonly | |
266 | - assert_response :success | |
267 | - end | |
268 | - | |
269 | - should 'not force ssl when not told to' do | |
270 | - @request.expects(:ssl?).returns(false).at_least_once | |
271 | - get :doesnt_need_ssl | |
272 | - assert_response :success | |
273 | - end | |
274 | - | |
275 | - should 'not force ssl when already in ssl' do | |
276 | - @request.expects(:ssl?).returns(true).at_least_once | |
277 | - get :sslonly | |
278 | - assert_response :success | |
279 | - end | |
280 | - | |
281 | - should 'keep arguments when redirecting to ssl' do | |
282 | - Environment.default.update_attribute(:enable_ssl, true) | |
283 | - @request.expects(:ssl?).returns(false).at_least_once | |
284 | - get :sslonly, :x => '1', :y => '2' | |
285 | - assert_redirected_to :protocol => 'https://', :x => '1', :y => '2' | |
286 | - end | |
287 | - | |
288 | - should 'refuse ssl when told to' do | |
289 | - @request.expects(:ssl?).returns(true).at_least_once | |
290 | - get :nossl | |
291 | - assert_redirected_to :protocol => "http://" | |
292 | - end | |
293 | - | |
294 | - should 'not refuse ssl when not told to' do | |
295 | - @request.expects(:ssl?).returns(true).at_least_once | |
296 | - get :doesnt_refuse_ssl | |
297 | - assert_response :success | |
298 | - end | |
299 | - should 'not refuse ssl while in development mode' do | |
300 | - ENV.expects(:[]).with('RAILS_ENV').returns('development').at_least_once | |
301 | - @request.expects(:ssl?).returns(true).at_least_once | |
302 | - get :nossl | |
303 | - assert_response :success | |
304 | - end | |
305 | - should 'not refuse ssl when not in ssl' do | |
306 | - @request.expects(:ssl?).returns(false).at_least_once | |
307 | - get :nossl | |
308 | - assert_response :success | |
309 | - end | |
310 | - | |
311 | - should 'keep arguments when redirecting to non-ssl' do | |
312 | - @request.expects(:ssl?).returns(true).at_least_once | |
313 | - get :nossl, :x => '1', :y => '2' | |
314 | - assert_redirected_to :protocol => 'http://', :x => '1', :y => '2' | |
315 | - end | |
316 | - | |
317 | - should 'add https protocols on redirect_to_ssl' do | |
318 | - Environment.default.update_attribute(:enable_ssl, true) | |
319 | - get :sslonly, :x => '1', :y => '1' | |
320 | - assert_redirected_to :x => '1', :y => '1', :protocol => 'https://' | |
321 | - end | |
322 | - | |
323 | - should 'return true in redirect_to_ssl' do | |
324 | - env = mock | |
325 | - env.expects(:enable_ssl).returns(true) | |
326 | - env.stubs(:default_hostname).returns('test.mydomain.net') | |
327 | - @controller.stubs(:environment).returns(env) | |
328 | - @controller.expects(:params).returns({}) | |
329 | - @controller.expects(:redirect_to).with({:protocol => 'https://', :host => 'test.mydomain.net'}) | |
330 | - assert_equal true, @controller.redirect_to_ssl | |
331 | - end | |
332 | - should 'return false in redirect_to_ssl when ssl is disabled' do | |
333 | - env = mock | |
334 | - env.expects(:enable_ssl).returns(false) | |
335 | - @controller.expects(:environment).returns(env) | |
336 | - assert_equal false, @controller.redirect_to_ssl | |
337 | - end | |
338 | - | |
339 | - should 'not force ssl when ssl is disabled' do | |
340 | - env = Environment.default | |
341 | - env.expects(:enable_ssl).returns(false) | |
342 | - @controller.stubs(:environment).returns(env) | |
343 | - @request.expects(:ssl?).returns(false).at_least_once | |
344 | - get :sslonly | |
345 | - assert_response :success | |
346 | - end | |
347 | - | |
348 | 255 | should 'not display categories menu if categories feature disabled' do |
349 | 256 | Environment.any_instance.stubs(:enabled?).with(anything).returns(true) |
350 | 257 | c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) |
... | ... | @@ -403,17 +310,6 @@ class ApplicationControllerTest < Test::Unit::TestCase |
403 | 310 | assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s} |
404 | 311 | end |
405 | 312 | |
406 | - should 'return false when not avoid ssl' do | |
407 | - req = mock | |
408 | - req.stubs(:ssl?).returns(true) | |
409 | - | |
410 | - @controller.expects(:request).returns(req) | |
411 | - @controller.stubs(:params).returns({}) | |
412 | - @controller.stubs(:redirect_to) | |
413 | - | |
414 | - assert_equal false, @controller.avoid_ssl | |
415 | - end | |
416 | - | |
417 | 313 | should 'diplay name of environment in description' do |
418 | 314 | get :index |
419 | 315 | assert_tag :tag => 'meta', :attributes => { :name => 'description', :content => assigns(:environment).name } | ... | ... |
test/functional/browse_controller_test.rb
... | ... | @@ -9,7 +9,6 @@ class BrowseControllerTest < Test::Unit::TestCase |
9 | 9 | def setup |
10 | 10 | @controller = BrowseController.new |
11 | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(false) | |
13 | 12 | @response = ActionController::TestResponse.new |
14 | 13 | |
15 | 14 | # By pass user validation on person creation | ... | ... |
test/functional/categories_controller_test.rb
... | ... | @@ -9,7 +9,6 @@ class CategoriesControllerTest < Test::Unit::TestCase |
9 | 9 | def setup |
10 | 10 | @controller = CategoriesController.new |
11 | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(true) | |
13 | 12 | @response = ActionController::TestResponse.new |
14 | 13 | |
15 | 14 | @env = fast_create(Environment, :name => "My test environment") | ... | ... |
test/functional/cms_controller_test.rb
... | ... | @@ -11,7 +11,6 @@ class CmsControllerTest < Test::Unit::TestCase |
11 | 11 | def setup |
12 | 12 | @controller = CmsController.new |
13 | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | |
15 | 14 | @response = ActionController::TestResponse.new |
16 | 15 | |
17 | 16 | @profile = create_user_with_permission('testinguser', 'post_content') |
... | ... | @@ -759,33 +758,6 @@ class CmsControllerTest < Test::Unit::TestCase |
759 | 758 | end |
760 | 759 | end |
761 | 760 | |
762 | - should 'require ssl in general' do | |
763 | - Environment.default.update_attribute(:enable_ssl, true) | |
764 | - @request.expects(:ssl?).returns(false).at_least_once | |
765 | - get :index, :profile => 'testinguser' | |
766 | - assert_redirected_to :protocol => 'https://' | |
767 | - end | |
768 | - | |
769 | - should 'accept ajax connections to new action without ssl' do | |
770 | - @request.expects(:ssl?).returns(false).at_least_once | |
771 | - xml_http_request :get, :new, :profile => 'testinguser' | |
772 | - assert_response :success | |
773 | - end | |
774 | - | |
775 | - should 'not loose type argument in new action when redirecting to ssl' do | |
776 | - Environment.default.update_attribute(:enable_ssl, true) | |
777 | - @request.expects(:ssl?).returns(false).at_least_once | |
778 | - get :new, :profile => 'testinguser', :type => 'Folder' | |
779 | - assert_redirected_to :protocol => 'https://', :action => 'new', :type => 'Folder' | |
780 | - end | |
781 | - | |
782 | - should 'not accept non-ajax connections to new action without ssl' do | |
783 | - Environment.default.update_attribute(:enable_ssl, true) | |
784 | - @request.expects(:ssl?).returns(false).at_least_once | |
785 | - get :new, :profile => 'testinguser' | |
786 | - assert_redirected_to :protocol => 'https://' | |
787 | - end | |
788 | - | |
789 | 761 | should 'display categories if environment disable_categories disabled' do |
790 | 762 | Environment.any_instance.stubs(:enabled?).with(anything).returns(false) |
791 | 763 | a = profile.articles.create!(:name => 'test') | ... | ... |
test/functional/content_viewer_controller_test.rb
... | ... | @@ -316,7 +316,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
316 | 316 | community.add_member(profile) |
317 | 317 | login_as(profile.identifier) |
318 | 318 | |
319 | - @request.stubs(:ssl?).returns(true) | |
320 | 319 | get :view_page, :profile => community.identifier, :page => [ folder.path ] |
321 | 320 | |
322 | 321 | assert_template 'access_denied.rhtml' |
... | ... | @@ -329,7 +328,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
329 | 328 | |
330 | 329 | login_as(profile.identifier) |
331 | 330 | |
332 | - @request.stubs(:ssl?).returns(true) | |
333 | 331 | get :view_page, :profile => community.identifier, :page => [ 'test' ] |
334 | 332 | assert_response :success |
335 | 333 | end |
... | ... | @@ -341,7 +339,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
341 | 339 | |
342 | 340 | login_as(profile.identifier) |
343 | 341 | |
344 | - @request.stubs(:ssl?).returns(true) | |
345 | 342 | get :view_page, :profile => community.identifier, :page => [ 'test' ] |
346 | 343 | assert_response :success |
347 | 344 | end |
... | ... | @@ -400,7 +397,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
400 | 397 | profile = Profile.create!(:name => 'test profile', :identifier => 'test_profile') |
401 | 398 | intranet = Folder.create!(:name => 'my_intranet', :profile => profile, :published => false) |
402 | 399 | |
403 | - @request.stubs(:ssl?).returns(true) | |
404 | 400 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
405 | 401 | |
406 | 402 | assert_template 'access_denied.rhtml' |
... | ... | @@ -411,7 +407,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
411 | 407 | profile = Profile.create!(:name => 'test profile', :identifier => 'test_profile') |
412 | 408 | intranet = Folder.create!(:name => 'my_intranet', :profile => profile, :published => false) |
413 | 409 | |
414 | - @request.stubs(:ssl?).returns(true) | |
415 | 410 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
416 | 411 | |
417 | 412 | assert_template 'access_denied.rhtml' |
... | ... | @@ -424,7 +419,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
424 | 419 | profile.affiliate(person, Profile::Roles.member(profile.environment.id)) |
425 | 420 | login_as('test_user') |
426 | 421 | |
427 | - @request.stubs(:ssl?).returns(true) | |
428 | 422 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
429 | 423 | |
430 | 424 | assert_template 'access_denied.rhtml' |
... | ... | @@ -437,7 +431,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
437 | 431 | profile.affiliate(person, Profile::Roles.moderator(profile.environment.id)) |
438 | 432 | login_as('test_user') |
439 | 433 | |
440 | - @request.stubs(:ssl?).returns(true) | |
441 | 434 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
442 | 435 | |
443 | 436 | assert_template 'view_page' |
... | ... | @@ -450,7 +443,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
450 | 443 | profile.affiliate(person, Profile::Roles.admin(profile.environment.id)) |
451 | 444 | login_as('test_user') |
452 | 445 | |
453 | - @request.stubs(:ssl?).returns(true) | |
454 | 446 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
455 | 447 | |
456 | 448 | assert_template 'view_page' |
... | ... | @@ -473,28 +465,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
473 | 465 | assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)} |
474 | 466 | end |
475 | 467 | |
476 | - should 'require SSL for viewing non-public articles' do | |
477 | - Environment.default.update_attribute(:enable_ssl, true) | |
478 | - page = profile.articles.create!(:name => 'myarticle', :body => 'top secret', :published => false) | |
479 | - get :view_page, :profile => 'testinguser', :page => [ 'myarticle' ] | |
480 | - assert_redirected_to :protocol => 'https://', :profile => 'testinguser', :page => [ 'myarticle' ] | |
481 | - end | |
482 | - | |
483 | - should 'avoid SSL for viewing public articles' do | |
484 | - @request.expects(:ssl?).returns(true).at_least_once | |
485 | - page = profile.articles.create!(:name => 'myarticle', :body => 'top secret', :published => true) | |
486 | - get :view_page, :profile => 'testinguser', :page => [ 'myarticle' ] | |
487 | - assert_redirected_to :protocol => 'http://', :profile => 'testinguser', :page => [ 'myarticle' ] | |
488 | - end | |
489 | - | |
490 | - should 'not redirect to SSL if already on SSL' do | |
491 | - @request.expects(:ssl?).returns(true).at_least_once | |
492 | - page = profile.articles.create!(:name => 'myarticle', :body => 'top secret', :published => false) | |
493 | - login_as('testinguser') | |
494 | - get :view_page, :profile => 'testinguser', :page => [ 'myarticle' ] | |
495 | - assert_response :success | |
496 | - end | |
497 | - | |
498 | 468 | should 'not show link to publication on view if not on person profile' do |
499 | 469 | prof = Community.create!(:name => 'test comm', :identifier => 'test_comm') |
500 | 470 | page = prof.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
... | ... | @@ -506,14 +476,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase |
506 | 476 | assert_no_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + prof.identifier + '/cms/publish/' + page.id.to_s)} |
507 | 477 | end |
508 | 478 | |
509 | - should 'deny access before trying SSL when SSL is disabled' do | |
510 | - @controller.expects(:redirect_to_ssl).returns(false) | |
511 | - profile = create_user('testuser', {}, :visible => false).person | |
512 | - | |
513 | - get :view_page, :profile => 'testuser', :page => profile.home_page.explode_path | |
514 | - assert_response 403 | |
515 | - end | |
516 | - | |
517 | 479 | should 'redirect to new article path under an old path' do |
518 | 480 | p = create_user('test_user').person |
519 | 481 | a = p.articles.create(:name => 'old-name') | ... | ... |
test/functional/edit_template_controller_test.rb
... | ... | @@ -11,7 +11,6 @@ class EditTemplateControllerTest < Test::Unit::TestCase |
11 | 11 | def setup |
12 | 12 | @controller = EditTemplateController.new |
13 | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | |
15 | 14 | @response = ActionController::TestResponse.new |
16 | 15 | login_as 'ze' |
17 | 16 | end | ... | ... |
test/functional/enterprise_registration_controller_test.rb
test/functional/enterprise_validation_controller_test.rb
... | ... | @@ -11,7 +11,6 @@ class EnterpriseValidationControllerTest < Test::Unit::TestCase |
11 | 11 | def setup |
12 | 12 | @controller = EnterpriseValidationController.new |
13 | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | |
15 | 14 | @response = ActionController::TestResponse.new |
16 | 15 | |
17 | 16 | login_as 'ze' | ... | ... |
test/functional/favorite_enterprises_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class FavoriteEnterprisesControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = FavoriteEnterprisesController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | |
16 | 15 | self.profile = create_user('testuser').person | ... | ... |
test/functional/features_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class FeaturesControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = FeaturesController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | login_as(create_admin_user(Environment.find(2))) |
16 | 15 | end | ... | ... |
test/functional/friends_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class FriendsControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = FriendsController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | |
16 | 15 | self.profile = create_user('testuser').person | ... | ... |
test/functional/mailconf_controller_test.rb
... | ... | @@ -7,7 +7,6 @@ class MailconfControllerTest < Test::Unit::TestCase |
7 | 7 | def setup |
8 | 8 | @controller = MailconfController.new |
9 | 9 | @request = ActionController::TestRequest.new |
10 | - @request.stubs(:ssl?).returns(true) | |
11 | 10 | @response = ActionController::TestResponse.new |
12 | 11 | |
13 | 12 | MailConf.stubs(:enabled?).returns(true) | ... | ... |
test/functional/manage_products_controller_test.rb
... | ... | @@ -9,7 +9,6 @@ class ManageProductsControllerTest < Test::Unit::TestCase |
9 | 9 | def setup |
10 | 10 | @controller = ManageProductsController.new |
11 | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(true) | |
13 | 12 | @response = ActionController::TestResponse.new |
14 | 13 | @enterprise = fast_create(Enterprise, :name => 'teste', :identifier => 'test_ent') |
15 | 14 | @user = create_user_with_permission('test_user', 'manage_products', @enterprise) | ... | ... |
test/functional/memberships_controller_test.rb
... | ... | @@ -12,7 +12,6 @@ class MembershipsControllerTest < Test::Unit::TestCase |
12 | 12 | def setup |
13 | 13 | @controller = MembershipsController.new |
14 | 14 | @request = ActionController::TestRequest.new |
15 | - @request.stubs(:ssl?).returns(true) | |
16 | 15 | @response = ActionController::TestResponse.new |
17 | 16 | |
18 | 17 | @profile = create_user('testuser').person | ... | ... |
test/functional/my_profile_controller_test.rb
... | ... | @@ -17,7 +17,6 @@ class MyProfileControllerTest < Test::Unit::TestCase |
17 | 17 | def setup |
18 | 18 | @controller = MyProfileController.new |
19 | 19 | @request = ActionController::TestRequest.new |
20 | - @request.stubs(:ssl?).returns(true) | |
21 | 20 | @response = ActionController::TestResponse.new |
22 | 21 | end |
23 | 22 | ... | ... |
test/functional/plugins_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class PluginsControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = PluginsController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | @environment = Environment.default |
16 | 15 | login_as(create_admin_user(@environment)) | ... | ... |
test/functional/profile_design_controller_test.rb
... | ... | @@ -17,7 +17,6 @@ class ProfileDesignControllerTest < Test::Unit::TestCase |
17 | 17 | def setup |
18 | 18 | @controller = ProfileDesignController.new |
19 | 19 | @request = ActionController::TestRequest.new |
20 | - @request.stubs(:ssl?).returns(true) | |
21 | 20 | @response = ActionController::TestResponse.new |
22 | 21 | |
23 | 22 | @profile = @holder = create_user('designtestuser').person | ... | ... |
test/functional/profile_editor_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class ProfileEditorControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = ProfileEditorController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | @profile = create_user('default_user').person |
16 | 15 | Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id)) | ... | ... |
test/functional/profile_members_controller_test.rb
... | ... | @@ -8,7 +8,6 @@ class ProfileMembersControllerTest < Test::Unit::TestCase |
8 | 8 | def setup |
9 | 9 | @controller = ProfileMembersController.new |
10 | 10 | @request = ActionController::TestRequest.new |
11 | - @request.stubs(:ssl?).returns(true) | |
12 | 11 | @response = ActionController::TestResponse.new |
13 | 12 | end |
14 | 13 | ... | ... |
test/functional/public_controller_test.rb
... | ... | @@ -6,23 +6,8 @@ class PublicController; def rescue_action(e) raise e end; end |
6 | 6 | |
7 | 7 | class PublicControllerTest < Test::Unit::TestCase |
8 | 8 | |
9 | - class TestingPublicStuffController < PublicController | |
10 | - def index | |
11 | - render :text => 'test', :layout => false | |
12 | - end | |
13 | - end | |
14 | - | |
15 | - def setup | |
16 | - @controller = TestingPublicStuffController.new | |
17 | - @request = ActionController::TestRequest.new | |
18 | - @request.stubs(:ssl?).returns(true) | |
19 | - @response = ActionController::TestResponse.new | |
20 | - end | |
21 | - | |
22 | - # Replace this with your real tests. | |
23 | - should 'refuse SSL' do | |
24 | - get :index | |
25 | - assert_redirected_to :protocol => 'http://' | |
9 | + should 'inherit from ApplicationController' do | |
10 | + assert_kind_of ApplicationController, PublicController.new | |
26 | 11 | end |
27 | 12 | |
28 | 13 | end | ... | ... |
test/functional/region_validators_controller_test.rb
... | ... | @@ -9,7 +9,6 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase |
9 | 9 | def setup |
10 | 10 | @controller = RegionValidatorsController.new |
11 | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(true) | |
13 | 12 | @response = ActionController::TestResponse.new |
14 | 13 | login_as('ze') |
15 | 14 | end | ... | ... |
test/functional/role_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class RoleControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = RoleController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | @role = Role.find(:first) |
16 | 15 | login_as(:ze) | ... | ... |
test/functional/tasks_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class TasksControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = TasksController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | |
16 | 15 | self.profile = create_user('testuser').person | ... | ... |
test/functional/themes_controller_test.rb
... | ... | @@ -8,7 +8,6 @@ class ThemesControllerTest < Test::Unit::TestCase |
8 | 8 | def setup |
9 | 9 | @controller = ThemesController.new |
10 | 10 | @request = ActionController::TestRequest.new |
11 | - @request.stubs(:ssl?).returns(true) | |
12 | 11 | @response = ActionController::TestResponse.new |
13 | 12 | |
14 | 13 | Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) | ... | ... |
test/functional/users_controller_test.rb
... | ... | @@ -10,7 +10,6 @@ class UsersControllerTest < Test::Unit::TestCase |
10 | 10 | def setup |
11 | 11 | @controller = UsersController.new |
12 | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | |
14 | 13 | @response = ActionController::TestResponse.new |
15 | 14 | end |
16 | 15 | ... | ... |
test/integration/login_to_the_application_test.rb
... | ... | @@ -4,8 +4,6 @@ class LoginToTheApplicationTest < ActionController::IntegrationTest |
4 | 4 | fixtures :users, :environments, :profiles |
5 | 5 | |
6 | 6 | def test_unauthenticated_user_tries_to_access_his_control_panel |
7 | - Environment.any_instance.stubs(:enable_ssl).returns(false) # ignore SSL for this test | |
8 | - | |
9 | 7 | get '/myprofile/ze' |
10 | 8 | assert_redirected_to '/account/login' |
11 | 9 | ... | ... |
test/mocks/test/test_controller.rb
... | ... | @@ -39,20 +39,4 @@ class TestController < ApplicationController |
39 | 39 | ' |
40 | 40 | end |
41 | 41 | |
42 | - require_ssl :only => 'sslonly' | |
43 | - def sslonly | |
44 | - render :text => 'this should be seen only on SSL', :layout => false | |
45 | - end | |
46 | - def doesnt_need_ssl | |
47 | - render :text => 'this should be seen even without SSL', :layout => false | |
48 | - end | |
49 | - | |
50 | - refuse_ssl :only => 'nossl' | |
51 | - def nossl | |
52 | - render :text => 'this should not be seen over SSL', :layout => false | |
53 | - end | |
54 | - def doesnt_refuse_ssl | |
55 | - render :text => 'this should be seen over SSL or not, whatever', :layout => false | |
56 | - end | |
57 | - | |
58 | 42 | end | ... | ... |
test/unit/application_helper_test.rb
... | ... | @@ -199,30 +199,6 @@ class ApplicationHelperTest < ActiveSupport::TestCase |
199 | 199 | assert_equal '/designs/templates/mytemplate/stylesheets/style.css', template_stylesheet_path |
200 | 200 | end |
201 | 201 | |
202 | - should 'use https:// for login_url' do | |
203 | - environment = Environment.default | |
204 | - environment.update_attribute(:enable_ssl, true) | |
205 | - environment.domains << Domain.new(:name => "test.domain.net", :is_default => true) | |
206 | - stubs(:environment).returns(environment) | |
207 | - | |
208 | - stubs(:url_for).with(has_entries(:protocol => 'https://', :host => 'test.domain.net')).returns('LALALA') | |
209 | - | |
210 | - assert_equal 'LALALA', login_url | |
211 | - end | |
212 | - | |
213 | - should 'not force ssl in login_url when environment has ssl disabled' do | |
214 | - environment = mock | |
215 | - environment.expects(:enable_ssl).returns(false).at_least_once | |
216 | - stubs(:environment).returns(environment) | |
217 | - request = mock | |
218 | - request.stubs(:host).returns('localhost') | |
219 | - stubs(:request).returns(request) | |
220 | - | |
221 | - expects(:url_for).with(has_entries(:protocol => 'https://')).never | |
222 | - expects(:url_for).with(has_key(:controller)).returns("LALALA") | |
223 | - assert_equal "LALALA", login_url | |
224 | - end | |
225 | - | |
226 | 202 | should 'return nil if disable_categories is enabled' do |
227 | 203 | env = fast_create(Environment, :name => 'env test') |
228 | 204 | stubs(:environment).returns(env) | ... | ... |
test/unit/environment_test.rb
... | ... | @@ -241,12 +241,6 @@ class EnvironmentTest < ActiveSupport::TestCase |
241 | 241 | assert_equal 'http://www.lalala.net:9999', env.top_url |
242 | 242 | end |
243 | 243 | |
244 | - should 'use https when asked for a ssl url' do | |
245 | - env = Environment.new | |
246 | - env.expects(:default_hostname).returns('www.lalala.net') | |
247 | - assert_equal 'https://www.lalala.net', env.top_url(true) | |
248 | - end | |
249 | - | |
250 | 244 | should 'provide an approval_method setting' do |
251 | 245 | env = Environment.new |
252 | 246 | |
... | ... | @@ -532,16 +526,6 @@ class EnvironmentTest < ActiveSupport::TestCase |
532 | 526 | assert_equal enterprise, e.enterprise_template |
533 | 527 | end |
534 | 528 | |
535 | - should 'not enable ssl by default' do | |
536 | - e = Environment.new | |
537 | - assert !e.enable_ssl | |
538 | - end | |
539 | - | |
540 | - should 'be able to enable ssl' do | |
541 | - e = Environment.new(:enable_ssl => true) | |
542 | - assert_equal true, e.enable_ssl | |
543 | - end | |
544 | - | |
545 | 529 | should 'have a layout template' do |
546 | 530 | e = Environment.new(:layout_template => 'mytemplate') |
547 | 531 | assert_equal 'mytemplate', e.layout_template | ... | ... |