Mercurial > hg > soundsoftware-site
comparison test/functional/auth_sources_controller_test.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
66 assert_equal 'cn', source.attr_login | 66 assert_equal 'cn', source.attr_login |
67 end | 67 end |
68 | 68 |
69 def test_create_with_failure | 69 def test_create_with_failure |
70 assert_no_difference 'AuthSourceLdap.count' do | 70 assert_no_difference 'AuthSourceLdap.count' do |
71 post :create, :type => 'AuthSourceLdap', :auth_source => {:name => 'Test', :host => '', :port => '389', :attr_login => 'cn'} | 71 post :create, :type => 'AuthSourceLdap', |
72 :auth_source => {:name => 'Test', :host => '', | |
73 :port => '389', :attr_login => 'cn'} | |
72 assert_response :success | 74 assert_response :success |
73 assert_template 'new' | 75 assert_template 'new' |
74 end | 76 end |
75 assert_error_tag :content => /host can't be blank/i | 77 assert_error_tag :content => /host #{ESCAPED_CANT} be blank/i |
76 end | 78 end |
77 | 79 |
78 def test_edit | 80 def test_edit |
79 get :edit, :id => 1 | 81 get :edit, :id => 1 |
80 | 82 |
99 get :edit, :id => 99 | 101 get :edit, :id => 99 |
100 assert_response 404 | 102 assert_response 404 |
101 end | 103 end |
102 | 104 |
103 def test_update | 105 def test_update |
104 put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '192.168.0.10', :port => '389', :attr_login => 'uid'} | 106 put :update, :id => 1, |
107 :auth_source => {:name => 'Renamed', :host => '192.168.0.10', | |
108 :port => '389', :attr_login => 'uid'} | |
105 assert_redirected_to '/auth_sources' | 109 assert_redirected_to '/auth_sources' |
106 | |
107 source = AuthSourceLdap.find(1) | 110 source = AuthSourceLdap.find(1) |
108 assert_equal 'Renamed', source.name | 111 assert_equal 'Renamed', source.name |
109 assert_equal '192.168.0.10', source.host | 112 assert_equal '192.168.0.10', source.host |
110 end | 113 end |
111 | 114 |
112 def test_update_with_failure | 115 def test_update_with_failure |
113 put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '', :port => '389', :attr_login => 'uid'} | 116 put :update, :id => 1, |
117 :auth_source => {:name => 'Renamed', :host => '', | |
118 :port => '389', :attr_login => 'uid'} | |
114 assert_response :success | 119 assert_response :success |
115 assert_template 'edit' | 120 assert_template 'edit' |
116 assert_error_tag :content => /host can't be blank/i | 121 assert_error_tag :content => /host #{ESCAPED_CANT} be blank/i |
117 end | 122 end |
118 | 123 |
119 def test_destroy | 124 def test_destroy |
120 assert_difference 'AuthSourceLdap.count', -1 do | 125 assert_difference 'AuthSourceLdap.count', -1 do |
121 delete :destroy, :id => 1 | 126 delete :destroy, :id => 1 |