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 | 12 | @controller = EditTemplateController.new |
13 | 13 | @request = ActionController::TestRequest.new |
14 | 14 | @response = ActionController::TestResponse.new |
15 | + login_as 'ze' | |
15 | 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 | 20 | get :index |
19 | 21 | assert_response :redirect |
20 | 22 | assert_redirected_to :action => 'design_editor' | ... | ... |
test/functional/profile_design_controller_test.rb
... | ... | @@ -135,6 +135,14 @@ class ProfileDesignControllerTest < Test::Unit::TestCase |
135 | 135 | assert_equal [1,2], [@b2,@b1].map {|item| item.position} |
136 | 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 | 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 | 23 | |
24 | 24 | should 'view validators for a specific region' do |
25 | 25 | environment = Environment.create!(:name => "my environment") |
26 | + give_permission('ze', 'manage_environment_validators', environment) | |
26 | 27 | region = Region.new(:name => 'my region') |
27 | 28 | environment.regions << region |
28 | 29 | assert !region.new_record? |
... | ... | @@ -38,12 +39,13 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase |
38 | 39 | |
39 | 40 | should 'search possible validators by name' do |
40 | 41 | environment = Environment.create!(:name => "my environment") |
42 | + give_permission('ze', 'manage_environment_validators', environment) | |
41 | 43 | region = Region.new(:name => 'my region') |
42 | 44 | environment.regions << region |
43 | 45 | assert !region.new_record? |
44 | 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 | 50 | get :search, :id => region.id, :search => 'frufru' |
49 | 51 | |
... | ... | @@ -53,6 +55,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase |
53 | 55 | |
54 | 56 | should 'be able to add validators to the current region' do |
55 | 57 | environment = Environment.create!(:name => "my environment") |
58 | + give_permission('ze', 'manage_environment_validators', environment) | |
56 | 59 | region = Region.new(:name => 'my region') |
57 | 60 | environment.regions << region |
58 | 61 | assert !region.new_record? |
... | ... | @@ -69,6 +72,7 @@ class RegionValidatorsControllerTest < Test::Unit::TestCase |
69 | 72 | |
70 | 73 | should 'be able to remove validators from the current region' do |
71 | 74 | environment = Environment.create!(:name => "my environment") |
75 | + give_permission('ze', 'manage_environment_validators', environment) | |
72 | 76 | region = Region.new(:name => 'my region') |
73 | 77 | environment.regions << region |
74 | 78 | assert !region.new_record? | ... | ... |