Skip to content

Commit 2718032

Browse files
committed
[22953] Fix running tests
1 parent d2a9d01 commit 2718032

File tree

6 files changed

+15
-18
lines changed

6 files changed

+15
-18
lines changed

.github/workflows/ruby.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: ./redmine update
4545

4646
- name: run prepare tests
47-
run: bundle exec rake db:test:prepare
47+
run: ./redmine exec bundle exec rake db:test:prepare
4848

4949
- name: run plugins tests
50-
run: bundle exec rake redmine:plugins:test
50+
run: ./redmine exec bundle exec rake redmine:plugins:test
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
class CreateAccessFilters < ActiveRecord::Migration
1+
class CreateAccessFilters < ActiveRecord::Migration[5.2]
22
def change
33
create_table :access_filters do |t|
44
t.references :user
@@ -7,4 +7,4 @@ def change
77
t.text :cidrs
88
end
99
end
10-
end
10+
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
class AddActiveFlagToAccessFilters < ActiveRecord::Migration
1+
class AddActiveFlagToAccessFilters < ActiveRecord::Migration[5.2]
22
def change
33
add_column :access_filters, :active, :boolean, :default => true
44
end
5-
end
5+
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
class AddPositionToAccessFilters < ActiveRecord::Migration
1+
class AddPositionToAccessFilters < ActiveRecord::Migration[5.2]
22
def change
33
add_column :access_filters, :position, :integer, :default => 0
44
end
5-
end
5+
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
class AddPolymorphismToAccessFilters < ActiveRecord::Migration
1+
class AddPolymorphismToAccessFilters < ActiveRecord::Migration[5.2]
22
def change
33
add_column :access_filters, :owner_type, :string
44
add_column :access_filters, :owner_id, :integer
55
remove_column :access_filters, :user_id
66
end
7-
end
7+
end

test/functional/access_filter_test.rb

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,10 @@ def setup
1717
AccessFilter.destroy_all
1818

1919
@controller = IssuesController.new
20-
@request = ActionController::TestRequest.new
21-
@response = ActionController::TestResponse.new
2220
@request.session[:user_id] = 1
2321
@request.env['REMOTE_ADDR'] = '192.168.0.1'
2422
@group = Group.create(:name => 'Test group')
2523
@group.users << User.find(1)
26-
2724
end
2825

2926
def test_works_if_no_rules_exist
@@ -45,7 +42,7 @@ def test_prevents_http_access_if_specified
4542
def test_prevents_api_access_if_specified
4643
AccessFilter.create(:owner_id => "User|1", :web => false, :api => true, :cidrs => 'any')
4744
with_settings :rest_api_enabled => '1' do
48-
get :index, :format => :json, :key => User.find(1).api_key
45+
get :index, :params => { :format => :json, :key => User.find(1).api_key}
4946
end
5047
assert_response 403
5148
end
@@ -77,7 +74,7 @@ def test_does_not_allow_http_access_if_ip_mismatched_for_subnet
7774
def test_allows_api_access_if_ip_matched
7875
AccessFilter.create(:owner_id => "User|1", :web => false, :api => false, :cidrs => '192.168.0.1')
7976
with_settings :rest_api_enabled => '1' do
80-
get :index, :format => :json, :key => User.find(1).api_key
77+
get :index, :params => {:format => :json, :key => User.find(1).api_key}
8178
end
8279

8380
assert_response :success
@@ -86,7 +83,7 @@ def test_allows_api_access_if_ip_matched
8683
def test_allows_api_access_if_ip_matched_for_subnet
8784
AccessFilter.create(:owner_id => "User|1", :web => false, :api => false, :cidrs => '192.168.0.0/24')
8885
with_settings :rest_api_enabled => '1' do
89-
get :index, :format => :json, :key => User.find(1).api_key
86+
get :index, :params => {:format => :json, :key => User.find(1).api_key}
9087
end
9188

9289
assert_response :success
@@ -95,7 +92,7 @@ def test_allows_api_access_if_ip_matched_for_subnet
9592
def test_does_not_allow_api_access_if_ip_mismatched_for_subnet
9693
AccessFilter.create(:owner_id => "User|1", :web => false, :api => false, :cidrs => '192.168.1.0/24')
9794
with_settings :rest_api_enabled => '1' do
98-
get :index, :format => :json, :key => User.find(1).api_key
95+
get :index, :params => {:format => :json, :key => User.find(1).api_key}
9996
end
10097
assert_response 403
10198
end
@@ -132,4 +129,4 @@ def test_access_filter_with_empty_cidrs_field_treated_as_any
132129
assert_response 200
133130
end
134131

135-
end
132+
end

0 commit comments

Comments
 (0)