##// END OF EJS Templates
Resourcified auth_sources....
Jean-Philippe Lang -
r9113:71e636ff7179
parent child
Show More
@@ -1,6 +1,6
1 1 <h2><%=l(:label_auth_source)%> (<%= h(@auth_source.auth_method_name) %>)</h2>
2 2
3 <% form_tag({:action => 'update', :id => @auth_source}, :class => "tabular") do %>
3 <% form_tag({:action => 'update', :id => @auth_source}, :method => :put, :class => "tabular") do %>
4 4 <%= render :partial => auth_source_partial_name(@auth_source) %>
5 5 <%= submit_tag l(:button_save) %>
6 6 <% end %>
@@ -22,7 +22,7
22 22 <td class="buttons">
23 23 <%= link_to l(:button_test), :action => 'test_connection', :id => source %>
24 24 <%= link_to l(:button_delete), { :action => 'destroy', :id => source },
25 :method => :post,
25 :method => :delete,
26 26 :confirm => l(:text_are_you_sure),
27 27 :class => 'icon icon-del',
28 28 :disabled => source.users.any? %>
@@ -353,22 +353,7 ActionController::Routing::Routes.draw do |map|
353 353 map.connect 'admin/default_configuration', :controller => 'admin',
354 354 :action => 'default_configuration', :conditions => {:method => :post}
355 355
356 # Used by AuthSourcesControllerTest
357 # TODO : refactor *AuthSourcesController to remove these routes
358 map.connect 'auth_sources', :controller => 'auth_sources',
359 :action => 'index', :conditions => {:method => :get}
360 map.connect 'auth_sources/new', :controller => 'auth_sources',
361 :action => 'new', :conditions => {:method => :get}
362 map.connect 'auth_sources/create', :controller => 'auth_sources',
363 :action => 'create', :conditions => {:method => :post}
364 map.connect 'auth_sources/destroy/:id', :controller => 'auth_sources',
365 :action => 'destroy', :id => /\d+/, :conditions => {:method => :post}
366 map.connect 'auth_sources/test_connection/:id', :controller => 'auth_sources',
367 :action => 'test_connection', :conditions => {:method => :get}
368 map.connect 'auth_sources/edit/:id', :controller => 'auth_sources',
369 :action => 'edit', :id => /\d+/, :conditions => {:method => :get}
370 map.connect 'auth_sources/update/:id', :controller => 'auth_sources',
371 :action => 'update', :id => /\d+/, :conditions => {:method => :post}
356 map.resources :auth_sources, :member => {:test_connection => :get}
372 357
373 358 map.connect 'workflows', :controller => 'workflows',
374 359 :action => 'index', :conditions => {:method => :get}
@@ -78,7 +78,7 class AuthSourcesControllerTest < ActionController::TestCase
78 78 end
79 79
80 80 def test_update
81 post :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '192.168.0.10', :port => '389', :attr_login => 'uid'}
81 put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '192.168.0.10', :port => '389', :attr_login => 'uid'}
82 82 assert_redirected_to '/auth_sources'
83 83
84 84 source = AuthSourceLdap.find(1)
@@ -87,7 +87,7 class AuthSourcesControllerTest < ActionController::TestCase
87 87 end
88 88
89 89 def test_update_with_failure
90 post :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '', :port => '389', :attr_login => 'uid'}
90 put :update, :id => 1, :auth_source => {:name => 'Renamed', :host => '', :port => '389', :attr_login => 'uid'}
91 91 assert_response :success
92 92 assert_template 'edit'
93 93 assert_error_tag :content => /host can't be blank/i
@@ -95,7 +95,7 class AuthSourcesControllerTest < ActionController::TestCase
95 95
96 96 def test_destroy
97 97 assert_difference 'AuthSourceLdap.count', -1 do
98 post :destroy, :id => 1
98 delete :destroy, :id => 1
99 99 end
100 100 end
101 101
@@ -103,7 +103,7 class AuthSourcesControllerTest < ActionController::TestCase
103 103 User.find(2).update_attribute :auth_source_id, 1
104 104
105 105 assert_no_difference 'AuthSourceLdap.count' do
106 post :destroy, :id => 1
106 delete :destroy, :id => 1
107 107 end
108 108 end
109 109
@@ -28,27 +28,27 class RoutingAuthSourcesTest < ActionController::IntegrationTest
28 28 { :controller => 'auth_sources', :action => 'new' }
29 29 )
30 30 assert_routing(
31 { :method => 'post', :path => "/auth_sources/create" },
31 { :method => 'post', :path => "/auth_sources" },
32 32 { :controller => 'auth_sources', :action => 'create' }
33 33 )
34 34 assert_routing(
35 { :method => 'post', :path => "/auth_sources/destroy/1234" },
36 { :controller => 'auth_sources', :action => 'destroy',
35 { :method => 'get', :path => "/auth_sources/1234/edit" },
36 { :controller => 'auth_sources', :action => 'edit',
37 37 :id => '1234' }
38 38 )
39 39 assert_routing(
40 { :method => 'get', :path => "/auth_sources/test_connection/1234" },
41 { :controller => 'auth_sources', :action => 'test_connection',
40 { :method => 'put', :path => "/auth_sources/1234" },
41 { :controller => 'auth_sources', :action => 'update',
42 42 :id => '1234' }
43 43 )
44 44 assert_routing(
45 { :method => 'get', :path => "/auth_sources/edit/1234" },
46 { :controller => 'auth_sources', :action => 'edit',
45 { :method => 'delete', :path => "/auth_sources/1234" },
46 { :controller => 'auth_sources', :action => 'destroy',
47 47 :id => '1234' }
48 48 )
49 49 assert_routing(
50 { :method => 'post', :path => "/auth_sources/update/1234" },
51 { :controller => 'auth_sources', :action => 'update',
50 { :method => 'get', :path => "/auth_sources/1234/test_connection" },
51 { :controller => 'auth_sources', :action => 'test_connection',
52 52 :id => '1234' }
53 53 )
54 54 end
General Comments 0
You need to be logged in to leave comments. Login now