Commit 41e682817c7188065e2058b360b28780cdfa51ce
1 parent
5d1530ae
Exists in
master
and in
29 other branches
ActionItem177: fixed some test to be aware of authetication
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1533 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
16 additions
and
2 deletions
Show diff stats
test/functional/edit_template_controller_test.rb
@@ -12,9 +12,11 @@ class EditTemplateControllerTest < Test::Unit::TestCase | @@ -12,9 +12,11 @@ class EditTemplateControllerTest < Test::Unit::TestCase | ||
12 | @controller = EditTemplateController.new | 12 | @controller = EditTemplateController.new |
13 | @request = ActionController::TestRequest.new | 13 | @request = ActionController::TestRequest.new |
14 | @response = ActionController::TestResponse.new | 14 | @response = ActionController::TestResponse.new |
15 | + login_as 'ze' | ||
15 | end | 16 | end |
16 | 17 | ||
17 | - def test_redirect_to_design_editoe_when_index_action_is_called | 18 | + def test_redirect_to_design_editor_when_index_action_is_called |
19 | + give_permission('ze', 'edit_environment_design', Environment.default) | ||
18 | get :index | 20 | get :index |
19 | assert_response :redirect | 21 | assert_response :redirect |
20 | assert_redirected_to :action => 'design_editor' | 22 | assert_redirected_to :action => 'design_editor' |
test/functional/profile_design_controller_test.rb
@@ -135,6 +135,14 @@ class ProfileDesignControllerTest < Test::Unit::TestCase | @@ -135,6 +135,14 @@ class ProfileDesignControllerTest < Test::Unit::TestCase | ||
135 | assert_equal [1,2], [@b2,@b1].map {|item| item.position} | 135 | assert_equal [1,2], [@b2,@b1].map {|item| item.position} |
136 | end | 136 | end |
137 | 137 | ||
138 | + def test_should_remove_block | ||
139 | + assert_difference Block, :count, -1 do | ||
140 | + post :remove, :profile => 'ze', :id => @b2.id | ||
141 | + assert_response :redirect | ||
142 | + assert_redirected_to :action => 'index' | ||
143 | + end | ||
144 | + end | ||
145 | + | ||
138 | ###################################################### | 146 | ###################################################### |
139 | # END - tests for BoxOrganizerController features | 147 | # END - tests for BoxOrganizerController features |
140 | ###################################################### | 148 | ###################################################### |
test/functional/region_validators_controller_test.rb
@@ -23,6 +23,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | @@ -23,6 +23,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | ||
23 | 23 | ||
24 | should 'view validators for a specific region' do | 24 | should 'view validators for a specific region' do |
25 | environment = Environment.create!(:name => "my environment") | 25 | environment = Environment.create!(:name => "my environment") |
26 | + give_permission('ze', 'manage_environment_validators', environment) | ||
26 | region = Region.new(:name => 'my region') | 27 | region = Region.new(:name => 'my region') |
27 | environment.regions << region | 28 | environment.regions << region |
28 | assert !region.new_record? | 29 | assert !region.new_record? |
@@ -38,12 +39,13 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | @@ -38,12 +39,13 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | ||
38 | 39 | ||
39 | should 'search possible validators by name' do | 40 | should 'search possible validators by name' do |
40 | environment = Environment.create!(:name => "my environment") | 41 | environment = Environment.create!(:name => "my environment") |
42 | + give_permission('ze', 'manage_environment_validators', environment) | ||
41 | region = Region.new(:name => 'my region') | 43 | region = Region.new(:name => 'my region') |
42 | environment.regions << region | 44 | environment.regions << region |
43 | assert !region.new_record? | 45 | assert !region.new_record? |
44 | org = Organization.create!(:name => "My frufru organization", :identifier => 'frufru', :environment_id => environment.id) | 46 | org = Organization.create!(:name => "My frufru organization", :identifier => 'frufru', :environment_id => environment.id) |
45 | 47 | ||
46 | - @controller.expects(:environment).returns(environment) | 48 | + @controller.expects(:environment).returns(environment).at_least_once |
47 | 49 | ||
48 | get :search, :id => region.id, :search => 'frufru' | 50 | get :search, :id => region.id, :search => 'frufru' |
49 | 51 | ||
@@ -53,6 +55,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | @@ -53,6 +55,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | ||
53 | 55 | ||
54 | should 'be able to add validators to the current region' do | 56 | should 'be able to add validators to the current region' do |
55 | environment = Environment.create!(:name => "my environment") | 57 | environment = Environment.create!(:name => "my environment") |
58 | + give_permission('ze', 'manage_environment_validators', environment) | ||
56 | region = Region.new(:name => 'my region') | 59 | region = Region.new(:name => 'my region') |
57 | environment.regions << region | 60 | environment.regions << region |
58 | assert !region.new_record? | 61 | assert !region.new_record? |
@@ -69,6 +72,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | @@ -69,6 +72,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase | ||
69 | 72 | ||
70 | should 'be able to remove validators from the current region' do | 73 | should 'be able to remove validators from the current region' do |
71 | environment = Environment.create!(:name => "my environment") | 74 | environment = Environment.create!(:name => "my environment") |
75 | + give_permission('ze', 'manage_environment_validators', environment) | ||
72 | region = Region.new(:name => 'my region') | 76 | region = Region.new(:name => 'my region') |
73 | environment.regions << region | 77 | environment.regions << region |
74 | assert !region.new_record? | 78 | assert !region.new_record? |