Commit 83726d732778475083b97339414fdc5caaadf422
1 parent
4488de24
Exists in
master
and in
22 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,34 +42,6 @@ class ApplicationController < ActionController::Base | ||
42 | include AuthenticatedSystem | 42 | include AuthenticatedSystem |
43 | include PermissionCheck | 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 | before_filter :set_locale | 45 | before_filter :set_locale |
74 | def set_locale | 46 | def set_locale |
75 | FastGettext.available_locales = Noosfero.available_locales | 47 | FastGettext.available_locales = Noosfero.available_locales |
app/controllers/my_profile/cms_controller.rb
@@ -23,15 +23,6 @@ class CmsController < MyProfileController | @@ -23,15 +23,6 @@ class CmsController < MyProfileController | ||
23 | profile.articles.find(c.params[:id]).allow_post_content?(user) | 23 | profile.articles.find(c.params[:id]).allow_post_content?(user) |
24 | end | 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 | def boxes_holder | 26 | def boxes_holder |
36 | profile | 27 | profile |
37 | end | 28 | end |
@@ -341,10 +332,6 @@ class CmsController < MyProfileController | @@ -341,10 +332,6 @@ class CmsController < MyProfileController | ||
341 | end | 332 | end |
342 | end | 333 | end |
343 | 334 | ||
344 | - def maybe_ssl(url) | ||
345 | - [url, url.sub('https:', 'http:')] | ||
346 | - end | ||
347 | - | ||
348 | def valid_article_type?(type) | 335 | def valid_article_type?(type) |
349 | (available_article_types + special_article_types).map {|item| item.name}.include?(type) | 336 | (available_article_types + special_article_types).map {|item| item.name}.include?(type) |
350 | end | 337 | end |
app/controllers/my_profile_controller.rb
app/controllers/public/account_controller.rb
@@ -4,7 +4,6 @@ class AccountController < ApplicationController | @@ -4,7 +4,6 @@ class AccountController < ApplicationController | ||
4 | 4 | ||
5 | inverse_captcha :field => 'e_mail' | 5 | inverse_captcha :field => 'e_mail' |
6 | 6 | ||
7 | - require_ssl :except => [ :login_popup, :logout_popup, :profile_details ] | ||
8 | 7 | ||
9 | before_filter :login_required, :only => [:activation_question, :accept_terms, :activate_enterprise] | 8 | before_filter :login_required, :only => [:activation_question, :accept_terms, :activate_enterprise] |
10 | before_filter :redirect_if_logged_in, :only => [:login, :signup] | 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,14 +33,6 @@ class ContentViewerController < ApplicationController | ||
33 | end | 33 | end |
34 | end | 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 | if !@page.display_to?(user) | 36 | if !@page.display_to?(user) |
45 | if profile.display_info_to?(user) || !profile.visible? | 37 | if profile.display_info_to?(user) || !profile.visible? |
46 | message = _('You are not allowed to view this content. You can contact the owner of this profile to request access then.') | 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,18 +876,11 @@ module ApplicationHelper | ||
876 | 876 | ||
877 | def login_url | 877 | def login_url |
878 | options = Noosfero.url_options.merge({ :controller => 'account', :action => 'login' }) | 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 | url_for(options) | 879 | url_for(options) |
883 | end | 880 | end |
884 | 881 | ||
885 | - def ssl_hostname | ||
886 | - environment.default_hostname | ||
887 | - end | ||
888 | - | ||
889 | def base_url | 882 | def base_url |
890 | - environment.top_url(request.ssl?) | 883 | + environment.top_url |
891 | end | 884 | end |
892 | 885 | ||
893 | def helper_for_article(article) | 886 | def helper_for_article(article) |
app/models/environment.rb
@@ -208,7 +208,6 @@ class Environment < ActiveRecord::Base | @@ -208,7 +208,6 @@ class Environment < ActiveRecord::Base | ||
208 | settings_items :layout_template, :type => String, :default => 'default' | 208 | settings_items :layout_template, :type => String, :default => 'default' |
209 | settings_items :homepage, :type => String | 209 | settings_items :homepage, :type => String |
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>' | 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 | settings_items :local_docs, :type => Array, :default => [] | 211 | settings_items :local_docs, :type => Array, :default => [] |
213 | settings_items :news_amount_by_folder, :type => Integer, :default => 4 | 212 | settings_items :news_amount_by_folder, :type => Integer, :default => 4 |
214 | settings_items :help_message_to_add_enterprise, :type => String, :default => '' | 213 | settings_items :help_message_to_add_enterprise, :type => String, :default => '' |
@@ -526,8 +525,8 @@ class Environment < ActiveRecord::Base | @@ -526,8 +525,8 @@ class Environment < ActiveRecord::Base | ||
526 | end | 525 | end |
527 | end | 526 | end |
528 | 527 | ||
529 | - def top_url(ssl = false) | ||
530 | - protocol = (ssl ? 'https' : 'http') | 528 | + def top_url |
529 | + protocol = 'http' | ||
531 | result = "#{protocol}://#{default_hostname}" | 530 | result = "#{protocol}://#{default_hostname}" |
532 | if Noosfero.url_options.has_key?(:port) | 531 | if Noosfero.url_options.has_key?(:port) |
533 | result << ':' << Noosfero.url_options[:port].to_s | 532 | result << ':' << Noosfero.url_options[:port].to_s |
test/functional/account_controller_test.rb
@@ -15,8 +15,6 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -15,8 +15,6 @@ class AccountControllerTest < Test::Unit::TestCase | ||
15 | @controller = AccountController.new | 15 | @controller = AccountController.new |
16 | @request = ActionController::TestRequest.new | 16 | @request = ActionController::TestRequest.new |
17 | @response = ActionController::TestResponse.new | 17 | @response = ActionController::TestResponse.new |
18 | - | ||
19 | - @request.stubs(:ssl?).returns(true) | ||
20 | end | 18 | end |
21 | 19 | ||
22 | def test_local_files_reference | 20 | def test_local_files_reference |
@@ -593,38 +591,6 @@ class AccountControllerTest < Test::Unit::TestCase | @@ -593,38 +591,6 @@ class AccountControllerTest < Test::Unit::TestCase | ||
593 | assert_equal 1, assigns(:user).person.boxes[0].blocks.size | 591 | assert_equal 1, assigns(:user).person.boxes[0].blocks.size |
594 | end | 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 | should 'render person partial' do | 594 | should 'render person partial' do |
629 | Environment.any_instance.expects(:signup_person_fields).returns(['contact_phone']).at_least_once | 595 | Environment.any_instance.expects(:signup_person_fields).returns(['contact_phone']).at_least_once |
630 | get :signup | 596 | get :signup |
test/functional/admin_controller_test.rb
@@ -6,28 +6,8 @@ class AdminController; def rescue_action(e) raise e end; end | @@ -6,28 +6,8 @@ class AdminController; def rescue_action(e) raise e end; end | ||
6 | 6 | ||
7 | class AdminControllerTest < Test::Unit::TestCase | 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 | end | 11 | end |
32 | 12 | ||
33 | end | 13 | end |
test/functional/admin_panel_controller_test.rb
@@ -10,7 +10,6 @@ class AdminPanelControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class AdminPanelControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = AdminPanelController.new | 11 | @controller = AdminPanelController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | login_as(create_admin_user(Environment.default)) | 14 | login_as(create_admin_user(Environment.default)) |
16 | end | 15 | end |
test/functional/application_controller_test.rb
@@ -252,99 +252,6 @@ class ApplicationControllerTest < Test::Unit::TestCase | @@ -252,99 +252,6 @@ class ApplicationControllerTest < Test::Unit::TestCase | ||
252 | get :index | 252 | get :index |
253 | end | 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 | should 'not display categories menu if categories feature disabled' do | 255 | should 'not display categories menu if categories feature disabled' do |
349 | Environment.any_instance.stubs(:enabled?).with(anything).returns(true) | 256 | Environment.any_instance.stubs(:enabled?).with(anything).returns(true) |
350 | c1 = Environment.default.categories.create!(:name => 'Category 1', :display_color => 1, :parent => nil, :display_in_menu => true ) | 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,17 +310,6 @@ class ApplicationControllerTest < Test::Unit::TestCase | ||
403 | assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s} | 310 | assert_no_tag :tag => 'div', :attributes => {:id => 'block-' + b.id.to_s} |
404 | end | 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 | should 'diplay name of environment in description' do | 313 | should 'diplay name of environment in description' do |
418 | get :index | 314 | get :index |
419 | assert_tag :tag => 'meta', :attributes => { :name => 'description', :content => assigns(:environment).name } | 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,7 +9,6 @@ class BrowseControllerTest < Test::Unit::TestCase | ||
9 | def setup | 9 | def setup |
10 | @controller = BrowseController.new | 10 | @controller = BrowseController.new |
11 | @request = ActionController::TestRequest.new | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(false) | ||
13 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
14 | 13 | ||
15 | # By pass user validation on person creation | 14 | # By pass user validation on person creation |
test/functional/categories_controller_test.rb
@@ -9,7 +9,6 @@ class CategoriesControllerTest < Test::Unit::TestCase | @@ -9,7 +9,6 @@ class CategoriesControllerTest < Test::Unit::TestCase | ||
9 | def setup | 9 | def setup |
10 | @controller = CategoriesController.new | 10 | @controller = CategoriesController.new |
11 | @request = ActionController::TestRequest.new | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(true) | ||
13 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
14 | 13 | ||
15 | @env = fast_create(Environment, :name => "My test environment") | 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,7 +11,6 @@ class CmsControllerTest < Test::Unit::TestCase | ||
11 | def setup | 11 | def setup |
12 | @controller = CmsController.new | 12 | @controller = CmsController.new |
13 | @request = ActionController::TestRequest.new | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | ||
15 | @response = ActionController::TestResponse.new | 14 | @response = ActionController::TestResponse.new |
16 | 15 | ||
17 | @profile = create_user_with_permission('testinguser', 'post_content') | 16 | @profile = create_user_with_permission('testinguser', 'post_content') |
@@ -759,33 +758,6 @@ class CmsControllerTest < Test::Unit::TestCase | @@ -759,33 +758,6 @@ class CmsControllerTest < Test::Unit::TestCase | ||
759 | end | 758 | end |
760 | end | 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 | should 'display categories if environment disable_categories disabled' do | 761 | should 'display categories if environment disable_categories disabled' do |
790 | Environment.any_instance.stubs(:enabled?).with(anything).returns(false) | 762 | Environment.any_instance.stubs(:enabled?).with(anything).returns(false) |
791 | a = profile.articles.create!(:name => 'test') | 763 | a = profile.articles.create!(:name => 'test') |
test/functional/content_viewer_controller_test.rb
@@ -316,7 +316,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -316,7 +316,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
316 | community.add_member(profile) | 316 | community.add_member(profile) |
317 | login_as(profile.identifier) | 317 | login_as(profile.identifier) |
318 | 318 | ||
319 | - @request.stubs(:ssl?).returns(true) | ||
320 | get :view_page, :profile => community.identifier, :page => [ folder.path ] | 319 | get :view_page, :profile => community.identifier, :page => [ folder.path ] |
321 | 320 | ||
322 | assert_template 'access_denied.rhtml' | 321 | assert_template 'access_denied.rhtml' |
@@ -329,7 +328,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -329,7 +328,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
329 | 328 | ||
330 | login_as(profile.identifier) | 329 | login_as(profile.identifier) |
331 | 330 | ||
332 | - @request.stubs(:ssl?).returns(true) | ||
333 | get :view_page, :profile => community.identifier, :page => [ 'test' ] | 331 | get :view_page, :profile => community.identifier, :page => [ 'test' ] |
334 | assert_response :success | 332 | assert_response :success |
335 | end | 333 | end |
@@ -341,7 +339,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -341,7 +339,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
341 | 339 | ||
342 | login_as(profile.identifier) | 340 | login_as(profile.identifier) |
343 | 341 | ||
344 | - @request.stubs(:ssl?).returns(true) | ||
345 | get :view_page, :profile => community.identifier, :page => [ 'test' ] | 342 | get :view_page, :profile => community.identifier, :page => [ 'test' ] |
346 | assert_response :success | 343 | assert_response :success |
347 | end | 344 | end |
@@ -400,7 +397,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -400,7 +397,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
400 | profile = Profile.create!(:name => 'test profile', :identifier => 'test_profile') | 397 | profile = Profile.create!(:name => 'test profile', :identifier => 'test_profile') |
401 | intranet = Folder.create!(:name => 'my_intranet', :profile => profile, :published => false) | 398 | intranet = Folder.create!(:name => 'my_intranet', :profile => profile, :published => false) |
402 | 399 | ||
403 | - @request.stubs(:ssl?).returns(true) | ||
404 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] | 400 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
405 | 401 | ||
406 | assert_template 'access_denied.rhtml' | 402 | assert_template 'access_denied.rhtml' |
@@ -411,7 +407,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -411,7 +407,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
411 | profile = Profile.create!(:name => 'test profile', :identifier => 'test_profile') | 407 | profile = Profile.create!(:name => 'test profile', :identifier => 'test_profile') |
412 | intranet = Folder.create!(:name => 'my_intranet', :profile => profile, :published => false) | 408 | intranet = Folder.create!(:name => 'my_intranet', :profile => profile, :published => false) |
413 | 409 | ||
414 | - @request.stubs(:ssl?).returns(true) | ||
415 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] | 410 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
416 | 411 | ||
417 | assert_template 'access_denied.rhtml' | 412 | assert_template 'access_denied.rhtml' |
@@ -424,7 +419,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -424,7 +419,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
424 | profile.affiliate(person, Profile::Roles.member(profile.environment.id)) | 419 | profile.affiliate(person, Profile::Roles.member(profile.environment.id)) |
425 | login_as('test_user') | 420 | login_as('test_user') |
426 | 421 | ||
427 | - @request.stubs(:ssl?).returns(true) | ||
428 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] | 422 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
429 | 423 | ||
430 | assert_template 'access_denied.rhtml' | 424 | assert_template 'access_denied.rhtml' |
@@ -437,7 +431,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -437,7 +431,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
437 | profile.affiliate(person, Profile::Roles.moderator(profile.environment.id)) | 431 | profile.affiliate(person, Profile::Roles.moderator(profile.environment.id)) |
438 | login_as('test_user') | 432 | login_as('test_user') |
439 | 433 | ||
440 | - @request.stubs(:ssl?).returns(true) | ||
441 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] | 434 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
442 | 435 | ||
443 | assert_template 'view_page' | 436 | assert_template 'view_page' |
@@ -450,7 +443,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -450,7 +443,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
450 | profile.affiliate(person, Profile::Roles.admin(profile.environment.id)) | 443 | profile.affiliate(person, Profile::Roles.admin(profile.environment.id)) |
451 | login_as('test_user') | 444 | login_as('test_user') |
452 | 445 | ||
453 | - @request.stubs(:ssl?).returns(true) | ||
454 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] | 446 | get :view_page, :profile => 'test_profile', :page => [ 'my-intranet' ] |
455 | 447 | ||
456 | assert_template 'view_page' | 448 | assert_template 'view_page' |
@@ -473,28 +465,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -473,28 +465,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
473 | assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)} | 465 | assert_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + profile.identifier + '/cms/publish/' + page.id.to_s)} |
474 | end | 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 | should 'not show link to publication on view if not on person profile' do | 468 | should 'not show link to publication on view if not on person profile' do |
499 | prof = Community.create!(:name => 'test comm', :identifier => 'test_comm') | 469 | prof = Community.create!(:name => 'test comm', :identifier => 'test_comm') |
500 | page = prof.articles.create!(:name => 'myarticle', :body => 'the body of the text') | 470 | page = prof.articles.create!(:name => 'myarticle', :body => 'the body of the text') |
@@ -506,14 +476,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | @@ -506,14 +476,6 @@ class ContentViewerControllerTest < Test::Unit::TestCase | ||
506 | assert_no_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + prof.identifier + '/cms/publish/' + page.id.to_s)} | 476 | assert_no_tag :tag => 'a', :attributes => {:href => ('/myprofile/' + prof.identifier + '/cms/publish/' + page.id.to_s)} |
507 | end | 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 | should 'redirect to new article path under an old path' do | 479 | should 'redirect to new article path under an old path' do |
518 | p = create_user('test_user').person | 480 | p = create_user('test_user').person |
519 | a = p.articles.create(:name => 'old-name') | 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,7 +11,6 @@ class EditTemplateControllerTest < Test::Unit::TestCase | ||
11 | def setup | 11 | def setup |
12 | @controller = EditTemplateController.new | 12 | @controller = EditTemplateController.new |
13 | @request = ActionController::TestRequest.new | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | ||
15 | @response = ActionController::TestResponse.new | 14 | @response = ActionController::TestResponse.new |
16 | login_as 'ze' | 15 | login_as 'ze' |
17 | end | 16 | end |
test/functional/enterprise_registration_controller_test.rb
@@ -11,7 +11,6 @@ all_fixtures | @@ -11,7 +11,6 @@ all_fixtures | ||
11 | def setup | 11 | def setup |
12 | @controller = EnterpriseRegistrationController.new | 12 | @controller = EnterpriseRegistrationController.new |
13 | @request = ActionController::TestRequest.new | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | ||
15 | @response = ActionController::TestResponse.new | 14 | @response = ActionController::TestResponse.new |
16 | login_as 'ze' | 15 | login_as 'ze' |
17 | end | 16 | end |
test/functional/enterprise_validation_controller_test.rb
@@ -11,7 +11,6 @@ class EnterpriseValidationControllerTest < Test::Unit::TestCase | @@ -11,7 +11,6 @@ class EnterpriseValidationControllerTest < Test::Unit::TestCase | ||
11 | def setup | 11 | def setup |
12 | @controller = EnterpriseValidationController.new | 12 | @controller = EnterpriseValidationController.new |
13 | @request = ActionController::TestRequest.new | 13 | @request = ActionController::TestRequest.new |
14 | - @request.stubs(:ssl?).returns(true) | ||
15 | @response = ActionController::TestResponse.new | 14 | @response = ActionController::TestResponse.new |
16 | 15 | ||
17 | login_as 'ze' | 16 | login_as 'ze' |
test/functional/favorite_enterprises_controller_test.rb
@@ -10,7 +10,6 @@ class FavoriteEnterprisesControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class FavoriteEnterprisesControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = FavoriteEnterprisesController.new | 11 | @controller = FavoriteEnterprisesController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | 14 | ||
16 | self.profile = create_user('testuser').person | 15 | self.profile = create_user('testuser').person |
test/functional/features_controller_test.rb
@@ -10,7 +10,6 @@ class FeaturesControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class FeaturesControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = FeaturesController.new | 11 | @controller = FeaturesController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | login_as(create_admin_user(Environment.find(2))) | 14 | login_as(create_admin_user(Environment.find(2))) |
16 | end | 15 | end |
test/functional/friends_controller_test.rb
@@ -10,7 +10,6 @@ class FriendsControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class FriendsControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = FriendsController.new | 11 | @controller = FriendsController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | 14 | ||
16 | self.profile = create_user('testuser').person | 15 | self.profile = create_user('testuser').person |
test/functional/mailconf_controller_test.rb
@@ -7,7 +7,6 @@ class MailconfControllerTest < Test::Unit::TestCase | @@ -7,7 +7,6 @@ class MailconfControllerTest < Test::Unit::TestCase | ||
7 | def setup | 7 | def setup |
8 | @controller = MailconfController.new | 8 | @controller = MailconfController.new |
9 | @request = ActionController::TestRequest.new | 9 | @request = ActionController::TestRequest.new |
10 | - @request.stubs(:ssl?).returns(true) | ||
11 | @response = ActionController::TestResponse.new | 10 | @response = ActionController::TestResponse.new |
12 | 11 | ||
13 | MailConf.stubs(:enabled?).returns(true) | 12 | MailConf.stubs(:enabled?).returns(true) |
test/functional/manage_products_controller_test.rb
@@ -9,7 +9,6 @@ class ManageProductsControllerTest < Test::Unit::TestCase | @@ -9,7 +9,6 @@ class ManageProductsControllerTest < Test::Unit::TestCase | ||
9 | def setup | 9 | def setup |
10 | @controller = ManageProductsController.new | 10 | @controller = ManageProductsController.new |
11 | @request = ActionController::TestRequest.new | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(true) | ||
13 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
14 | @enterprise = fast_create(Enterprise, :name => 'teste', :identifier => 'test_ent') | 13 | @enterprise = fast_create(Enterprise, :name => 'teste', :identifier => 'test_ent') |
15 | @user = create_user_with_permission('test_user', 'manage_products', @enterprise) | 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,7 +12,6 @@ class MembershipsControllerTest < Test::Unit::TestCase | ||
12 | def setup | 12 | def setup |
13 | @controller = MembershipsController.new | 13 | @controller = MembershipsController.new |
14 | @request = ActionController::TestRequest.new | 14 | @request = ActionController::TestRequest.new |
15 | - @request.stubs(:ssl?).returns(true) | ||
16 | @response = ActionController::TestResponse.new | 15 | @response = ActionController::TestResponse.new |
17 | 16 | ||
18 | @profile = create_user('testuser').person | 17 | @profile = create_user('testuser').person |
test/functional/my_profile_controller_test.rb
@@ -17,7 +17,6 @@ class MyProfileControllerTest < Test::Unit::TestCase | @@ -17,7 +17,6 @@ class MyProfileControllerTest < Test::Unit::TestCase | ||
17 | def setup | 17 | def setup |
18 | @controller = MyProfileController.new | 18 | @controller = MyProfileController.new |
19 | @request = ActionController::TestRequest.new | 19 | @request = ActionController::TestRequest.new |
20 | - @request.stubs(:ssl?).returns(true) | ||
21 | @response = ActionController::TestResponse.new | 20 | @response = ActionController::TestResponse.new |
22 | end | 21 | end |
23 | 22 |
test/functional/plugins_controller_test.rb
@@ -10,7 +10,6 @@ class PluginsControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class PluginsControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = PluginsController.new | 11 | @controller = PluginsController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | @environment = Environment.default | 14 | @environment = Environment.default |
16 | login_as(create_admin_user(@environment)) | 15 | login_as(create_admin_user(@environment)) |
test/functional/profile_design_controller_test.rb
@@ -17,7 +17,6 @@ class ProfileDesignControllerTest < Test::Unit::TestCase | @@ -17,7 +17,6 @@ class ProfileDesignControllerTest < Test::Unit::TestCase | ||
17 | def setup | 17 | def setup |
18 | @controller = ProfileDesignController.new | 18 | @controller = ProfileDesignController.new |
19 | @request = ActionController::TestRequest.new | 19 | @request = ActionController::TestRequest.new |
20 | - @request.stubs(:ssl?).returns(true) | ||
21 | @response = ActionController::TestResponse.new | 20 | @response = ActionController::TestResponse.new |
22 | 21 | ||
23 | @profile = @holder = create_user('designtestuser').person | 22 | @profile = @holder = create_user('designtestuser').person |
test/functional/profile_editor_controller_test.rb
@@ -10,7 +10,6 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = ProfileEditorController.new | 11 | @controller = ProfileEditorController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | @profile = create_user('default_user').person | 14 | @profile = create_user('default_user').person |
16 | Environment.default.affiliate(@profile, [Environment::Roles.admin(Environment.default.id)] + Profile::Roles.all_roles(Environment.default.id)) | 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,7 +8,6 @@ class ProfileMembersControllerTest < Test::Unit::TestCase | ||
8 | def setup | 8 | def setup |
9 | @controller = ProfileMembersController.new | 9 | @controller = ProfileMembersController.new |
10 | @request = ActionController::TestRequest.new | 10 | @request = ActionController::TestRequest.new |
11 | - @request.stubs(:ssl?).returns(true) | ||
12 | @response = ActionController::TestResponse.new | 11 | @response = ActionController::TestResponse.new |
13 | end | 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,23 +6,8 @@ class PublicController; def rescue_action(e) raise e end; end | ||
6 | 6 | ||
7 | class PublicControllerTest < Test::Unit::TestCase | 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 | end | 11 | end |
27 | 12 | ||
28 | end | 13 | end |
test/functional/region_validators_controller_test.rb
@@ -9,7 +9,6 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | @@ -9,7 +9,6 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | ||
9 | def setup | 9 | def setup |
10 | @controller = RegionValidatorsController.new | 10 | @controller = RegionValidatorsController.new |
11 | @request = ActionController::TestRequest.new | 11 | @request = ActionController::TestRequest.new |
12 | - @request.stubs(:ssl?).returns(true) | ||
13 | @response = ActionController::TestResponse.new | 12 | @response = ActionController::TestResponse.new |
14 | login_as('ze') | 13 | login_as('ze') |
15 | end | 14 | end |
test/functional/role_controller_test.rb
@@ -10,7 +10,6 @@ class RoleControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class RoleControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = RoleController.new | 11 | @controller = RoleController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | @role = Role.find(:first) | 14 | @role = Role.find(:first) |
16 | login_as(:ze) | 15 | login_as(:ze) |
test/functional/tasks_controller_test.rb
@@ -10,7 +10,6 @@ class TasksControllerTest < Test::Unit::TestCase | @@ -10,7 +10,6 @@ class TasksControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = TasksController.new | 11 | @controller = TasksController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | 14 | ||
16 | self.profile = create_user('testuser').person | 15 | self.profile = create_user('testuser').person |
test/functional/themes_controller_test.rb
@@ -8,7 +8,6 @@ class ThemesControllerTest < Test::Unit::TestCase | @@ -8,7 +8,6 @@ class ThemesControllerTest < Test::Unit::TestCase | ||
8 | def setup | 8 | def setup |
9 | @controller = ThemesController.new | 9 | @controller = ThemesController.new |
10 | @request = ActionController::TestRequest.new | 10 | @request = ActionController::TestRequest.new |
11 | - @request.stubs(:ssl?).returns(true) | ||
12 | @response = ActionController::TestResponse.new | 11 | @response = ActionController::TestResponse.new |
13 | 12 | ||
14 | Theme.stubs(:user_themes_dir).returns(TMP_THEMES_DIR) | 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,7 +10,6 @@ class UsersControllerTest < Test::Unit::TestCase | ||
10 | def setup | 10 | def setup |
11 | @controller = UsersController.new | 11 | @controller = UsersController.new |
12 | @request = ActionController::TestRequest.new | 12 | @request = ActionController::TestRequest.new |
13 | - @request.stubs(:ssl?).returns(true) | ||
14 | @response = ActionController::TestResponse.new | 13 | @response = ActionController::TestResponse.new |
15 | end | 14 | end |
16 | 15 |
test/integration/login_to_the_application_test.rb
@@ -4,8 +4,6 @@ class LoginToTheApplicationTest < ActionController::IntegrationTest | @@ -4,8 +4,6 @@ class LoginToTheApplicationTest < ActionController::IntegrationTest | ||
4 | fixtures :users, :environments, :profiles | 4 | fixtures :users, :environments, :profiles |
5 | 5 | ||
6 | def test_unauthenticated_user_tries_to_access_his_control_panel | 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 | get '/myprofile/ze' | 7 | get '/myprofile/ze' |
10 | assert_redirected_to '/account/login' | 8 | assert_redirected_to '/account/login' |
11 | 9 |
test/mocks/test/test_controller.rb
@@ -39,20 +39,4 @@ class TestController < ApplicationController | @@ -39,20 +39,4 @@ class TestController < ApplicationController | ||
39 | ' | 39 | ' |
40 | end | 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 | end | 42 | end |
test/unit/application_helper_test.rb
@@ -199,30 +199,6 @@ class ApplicationHelperTest < ActiveSupport::TestCase | @@ -199,30 +199,6 @@ class ApplicationHelperTest < ActiveSupport::TestCase | ||
199 | assert_equal '/designs/templates/mytemplate/stylesheets/style.css', template_stylesheet_path | 199 | assert_equal '/designs/templates/mytemplate/stylesheets/style.css', template_stylesheet_path |
200 | end | 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 | should 'return nil if disable_categories is enabled' do | 202 | should 'return nil if disable_categories is enabled' do |
227 | env = fast_create(Environment, :name => 'env test') | 203 | env = fast_create(Environment, :name => 'env test') |
228 | stubs(:environment).returns(env) | 204 | stubs(:environment).returns(env) |
test/unit/environment_test.rb
@@ -241,12 +241,6 @@ class EnvironmentTest < ActiveSupport::TestCase | @@ -241,12 +241,6 @@ class EnvironmentTest < ActiveSupport::TestCase | ||
241 | assert_equal 'http://www.lalala.net:9999', env.top_url | 241 | assert_equal 'http://www.lalala.net:9999', env.top_url |
242 | end | 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 | should 'provide an approval_method setting' do | 244 | should 'provide an approval_method setting' do |
251 | env = Environment.new | 245 | env = Environment.new |
252 | 246 | ||
@@ -532,16 +526,6 @@ class EnvironmentTest < ActiveSupport::TestCase | @@ -532,16 +526,6 @@ class EnvironmentTest < ActiveSupport::TestCase | ||
532 | assert_equal enterprise, e.enterprise_template | 526 | assert_equal enterprise, e.enterprise_template |
533 | end | 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 | should 'have a layout template' do | 529 | should 'have a layout template' do |
546 | e = Environment.new(:layout_template => 'mytemplate') | 530 | e = Environment.new(:layout_template => 'mytemplate') |
547 | assert_equal 'mytemplate', e.layout_template | 531 | assert_equal 'mytemplate', e.layout_template |