summaryrefslogtreecommitdiffstats
path: root/test/functional/auth_sources_controller_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/auth_sources_controller_test.rb')
-rw-r--r--test/functional/auth_sources_controller_test.rb82
1 files changed, 63 insertions, 19 deletions
diff --git a/test/functional/auth_sources_controller_test.rb b/test/functional/auth_sources_controller_test.rb
index 1ad829655..b3fbef0a5 100644
--- a/test/functional/auth_sources_controller_test.rb
+++ b/test/functional/auth_sources_controller_test.rb
@@ -40,13 +40,23 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
end
def test_new_with_invalid_type_should_respond_with_404
- get :new, :type => 'foo'
+ get :new, :params => {
+ :type => 'foo'
+ }
assert_response 404
end
def test_create
assert_difference 'AuthSourceLdap.count' do
- post :create, :type => 'AuthSourceLdap', :auth_source => {:name => 'Test', :host => '127.0.0.1', :port => '389', :attr_login => 'cn'}
+ post :create, :params => {
+ :type => 'AuthSourceLdap',
+ :auth_source => {
+ :name => 'Test',
+ :host => '127.0.0.1',
+ :port => '389',
+ :attr_login => 'cn'
+ }
+ }
assert_redirected_to '/auth_sources'
end
@@ -59,16 +69,24 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_create_with_failure
assert_no_difference 'AuthSourceLdap.count' do
- post :create, :type => 'AuthSourceLdap',
- :auth_source => {:name => 'Test', :host => '',
- :port => '389', :attr_login => 'cn'}
+ post :create, :params => {
+ :type => 'AuthSourceLdap',
+ :auth_source => {
+ :name => 'Test',
+ :host => '',
+ :port => '389',
+ :attr_login => 'cn'
+ }
+ }
assert_response :success
end
assert_select_error /host cannot be blank/i
end
def test_edit
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'form#auth_source_form' do
@@ -79,21 +97,31 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_edit_should_not_contain_password
AuthSource.find(1).update_column :account_password, 'secret'
- get :edit, :id => 1
+ get :edit, :params => {
+ :id => 1
+ }
assert_response :success
assert_select 'input[value=secret]', 0
assert_select 'input[name=dummy_password][value^=xxxxxx]'
end
def test_edit_invalid_should_respond_with_404
- get :edit, :id => 99
+ get :edit, :params => {
+ :id => 99
+ }
assert_response 404
end
def test_update
- put :update, :id => 1,
- :auth_source => {:name => 'Renamed', :host => '192.168.0.10',
- :port => '389', :attr_login => 'uid'}
+ put :update, :params => {
+ :id => 1,
+ :auth_source => {
+ :name => 'Renamed',
+ :host => '192.168.0.10',
+ :port => '389',
+ :attr_login => 'uid'
+ }
+ }
assert_redirected_to '/auth_sources'
source = AuthSourceLdap.find(1)
assert_equal 'Renamed', source.name
@@ -101,16 +129,24 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
end
def test_update_with_failure
- put :update, :id => 1,
- :auth_source => {:name => 'Renamed', :host => '',
- :port => '389', :attr_login => 'uid'}
+ put :update, :params => {
+ :id => 1,
+ :auth_source => {
+ :name => 'Renamed',
+ :host => '',
+ :port => '389',
+ :attr_login => 'uid'
+ }
+ }
assert_response :success
assert_select_error /host cannot be blank/i
end
def test_destroy
assert_difference 'AuthSourceLdap.count', -1 do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
end
end
@@ -119,7 +155,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
User.find(2).update_attribute :auth_source_id, 1
assert_no_difference 'AuthSourceLdap.count' do
- delete :destroy, :id => 1
+ delete :destroy, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
end
end
@@ -127,7 +165,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_test_connection
AuthSourceLdap.any_instance.stubs(:test_connection).returns(true)
- get :test_connection, :id => 1
+ get :test_connection, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
assert_not_nil flash[:notice]
assert_match /successful/i, flash[:notice]
@@ -136,7 +176,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
def test_test_connection_with_failure
AuthSourceLdap.any_instance.stubs(:initialize_ldap_con).raises(Net::LDAP::LdapError.new("Something went wrong"))
- get :test_connection, :id => 1
+ get :test_connection, :params => {
+ :id => 1
+ }
assert_redirected_to '/auth_sources'
assert_not_nil flash[:error]
assert_include 'Something went wrong', flash[:error]
@@ -148,7 +190,9 @@ class AuthSourcesControllerTest < Redmine::ControllerTest
{:login => 'Smith', :firstname => 'John', :lastname => 'Doe', :mail => 'foo2@example.net', :auth_source_id => 1}
])
- get :autocomplete_for_new_user, :term => 'foo'
+ get :autocomplete_for_new_user, :params => {
+ :term => 'foo'
+ }
assert_response :success
assert_equal 'application/json', response.content_type
json = ActiveSupport::JSON.decode(response.body)