diff options
Diffstat (limited to 'test')
22 files changed, 10 insertions, 82 deletions
diff --git a/test/integration/api_test/api_test.rb b/test/integration/api_test/api_test.rb index ab70533fa..56f8f8d4e 100644 --- a/test/integration/api_test/api_test.rb +++ b/test/integration/api_test/api_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::ApiTest < Redmine::ApiTest::Base fixtures :users - def setup - Setting.rest_api_enabled = '1' - end - def test_api_should_work_with_protect_from_forgery ActionController::Base.allow_forgery_protection = true assert_difference('User.count') do diff --git a/test/integration/api_test/attachments_test.rb b/test/integration/api_test/attachments_test.rb index 5a80f5cc7..bff956e80 100644 --- a/test/integration/api_test/attachments_test.rb +++ b/test/integration/api_test/attachments_test.rb @@ -28,11 +28,12 @@ class Redmine::ApiTest::AttachmentsTest < Redmine::ApiTest::Base :attachments def setup - Setting.rest_api_enabled = '1' + super set_fixtures_attachments_directory end def teardown + super set_tmp_attachments_directory end diff --git a/test/integration/api_test/authentication_test.rb b/test/integration/api_test/authentication_test.rb index 8452717e3..2369fd01a 100644 --- a/test/integration/api_test/authentication_test.rb +++ b/test/integration/api_test/authentication_test.rb @@ -20,14 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::AuthenticationTest < Redmine::ApiTest::Base fixtures :users - def setup - Setting.rest_api_enabled = '1' - end - - def teardown - Setting.rest_api_enabled = '0' - end - def test_api_should_deny_without_credentials get '/users/current.xml', {} assert_response 401 diff --git a/test/integration/api_test/custom_fields_attribute_test.rb b/test/integration/api_test/custom_fields_attribute_test.rb index 76ed44e57..cb3869bfb 100644 --- a/test/integration/api_test/custom_fields_attribute_test.rb +++ b/test/integration/api_test/custom_fields_attribute_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::CustomFieldsAttributeTest < Redmine::ApiTest::Base fixtures :users - def setup - Setting.rest_api_enabled = '1' - end - def test_integer_custom_fields_should_accept_strings field = GroupCustomField.generate!(:field_format => 'int') diff --git a/test/integration/api_test/custom_fields_test.rb b/test/integration/api_test/custom_fields_test.rb index 4ef6fc707..d6ec7ac41 100644 --- a/test/integration/api_test/custom_fields_test.rb +++ b/test/integration/api_test/custom_fields_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::CustomFieldsTest < Redmine::ApiTest::Base fixtures :users, :custom_fields - def setup - Setting.rest_api_enabled = '1' - end - test "GET /custom_fields.xml should return custom fields" do get '/custom_fields.xml', {}, credentials('admin') assert_response :success diff --git a/test/integration/api_test/enumerations_test.rb b/test/integration/api_test/enumerations_test.rb index 63161e466..30509d1e8 100644 --- a/test/integration/api_test/enumerations_test.rb +++ b/test/integration/api_test/enumerations_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::EnumerationsTest < Redmine::ApiTest::Base fixtures :enumerations - def setup - Setting.rest_api_enabled = '1' - end - test "GET /enumerations/issue_priorities.xml should return priorities" do get '/enumerations/issue_priorities.xml' assert_response :success diff --git a/test/integration/api_test/groups_test.rb b/test/integration/api_test/groups_test.rb index 550eb50e5..1efeaaa21 100644 --- a/test/integration/api_test/groups_test.rb +++ b/test/integration/api_test/groups_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::GroupsTest < Redmine::ApiTest::Base fixtures :users, :groups_users - def setup - Setting.rest_api_enabled = '1' - end - test "GET /groups.xml should require authentication" do get '/groups.xml' assert_response 401 diff --git a/test/integration/api_test/issue_categories_test.rb b/test/integration/api_test/issue_categories_test.rb index 712cfb0d1..c83b32961 100644 --- a/test/integration/api_test/issue_categories_test.rb +++ b/test/integration/api_test/issue_categories_test.rb @@ -24,10 +24,6 @@ class Redmine::ApiTest::IssueCategoriesTest < Redmine::ApiTest::Base :members, :enabled_modules - def setup - Setting.rest_api_enabled = '1' - end - test "GET /projects/:project_id/issue_categories.xml should return the issue categories" do get '/projects/1/issue_categories.xml', {}, credentials('jsmith') assert_response :success diff --git a/test/integration/api_test/issue_relations_test.rb b/test/integration/api_test/issue_relations_test.rb index 601e96067..09876c706 100644 --- a/test/integration/api_test/issue_relations_test.rb +++ b/test/integration/api_test/issue_relations_test.rb @@ -27,10 +27,6 @@ class Redmine::ApiTest::IssueRelationsTest < Redmine::ApiTest::Base :enabled_modules, :issue_relations - def setup - Setting.rest_api_enabled = '1' - end - test "GET /issues/:issue_id/relations.xml should return issue relations" do get '/issues/9/relations.xml', {}, credentials('jsmith') diff --git a/test/integration/api_test/issue_statuses_test.rb b/test/integration/api_test/issue_statuses_test.rb index 14a7f2d4d..e6c173a9d 100644 --- a/test/integration/api_test/issue_statuses_test.rb +++ b/test/integration/api_test/issue_statuses_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::IssueStatusesTest < Redmine::ApiTest::Base fixtures :issue_statuses - def setup - Setting.rest_api_enabled = '1' - end - test "GET /issue_statuses.xml should return issue statuses" do get '/issue_statuses.xml' diff --git a/test/integration/api_test/issues_test.rb b/test/integration/api_test/issues_test.rb index 68b9c6b77..ba8dbc6b2 100644 --- a/test/integration/api_test/issues_test.rb +++ b/test/integration/api_test/issues_test.rb @@ -44,10 +44,6 @@ class Redmine::ApiTest::IssuesTest < Redmine::ApiTest::Base :queries, :attachments - def setup - Setting.rest_api_enabled = '1' - end - test "GET /issues.xml should contain metadata" do get '/issues.xml' assert_select 'issues[type=array][total_count=?][limit="25"][offset="0"]', diff --git a/test/integration/api_test/memberships_test.rb b/test/integration/api_test/memberships_test.rb index 9f8ac24e8..aecd90aca 100644 --- a/test/integration/api_test/memberships_test.rb +++ b/test/integration/api_test/memberships_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::MembershipsTest < Redmine::ApiTest::Base fixtures :projects, :users, :roles, :members, :member_roles - def setup - Setting.rest_api_enabled = '1' - end - test "GET /projects/:project_id/memberships.xml should return memberships" do get '/projects/1/memberships.xml', {}, credentials('jsmith') diff --git a/test/integration/api_test/news_test.rb b/test/integration/api_test/news_test.rb index a450c4765..c526c5089 100644 --- a/test/integration/api_test/news_test.rb +++ b/test/integration/api_test/news_test.rb @@ -27,10 +27,6 @@ class Redmine::ApiTest::NewsTest < Redmine::ApiTest::Base :enabled_modules, :news - def setup - Setting.rest_api_enabled = '1' - end - test "GET /news.xml should return news" do get '/news.xml' diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb index 32d5eb919..dd25d2101 100644 --- a/test/integration/api_test/projects_test.rb +++ b/test/integration/api_test/projects_test.rb @@ -23,7 +23,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base :attachments, :custom_fields, :custom_values, :time_entries, :issue_categories def setup - Setting.rest_api_enabled = '1' + super set_tmp_attachments_directory end diff --git a/test/integration/api_test/queries_test.rb b/test/integration/api_test/queries_test.rb index 72e9ed5e2..2f54e6042 100644 --- a/test/integration/api_test/queries_test.rb +++ b/test/integration/api_test/queries_test.rb @@ -27,10 +27,6 @@ class Redmine::ApiTest::QueriesTest < Redmine::ApiTest::Base :enabled_modules, :queries - def setup - Setting.rest_api_enabled = '1' - end - test "GET /queries.xml should return queries" do get '/queries.xml' diff --git a/test/integration/api_test/roles_test.rb b/test/integration/api_test/roles_test.rb index 4f04b4b25..badffa1b0 100644 --- a/test/integration/api_test/roles_test.rb +++ b/test/integration/api_test/roles_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::RolesTest < Redmine::ApiTest::Base fixtures :roles - def setup - Setting.rest_api_enabled = '1' - end - test "GET /roles.xml should return the roles" do get '/roles.xml' diff --git a/test/integration/api_test/time_entries_test.rb b/test/integration/api_test/time_entries_test.rb index 9fa93cd27..b118ed72f 100644 --- a/test/integration/api_test/time_entries_test.rb +++ b/test/integration/api_test/time_entries_test.rb @@ -27,10 +27,6 @@ class Redmine::ApiTest::TimeEntriesTest < Redmine::ApiTest::Base :enabled_modules, :time_entries - def setup - Setting.rest_api_enabled = '1' - end - test "GET /time_entries.xml should return time entries" do get '/time_entries.xml', {}, credentials('jsmith') assert_response :success diff --git a/test/integration/api_test/trackers_test.rb b/test/integration/api_test/trackers_test.rb index d85e2a4c3..708389634 100644 --- a/test/integration/api_test/trackers_test.rb +++ b/test/integration/api_test/trackers_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::TrackersTest < Redmine::ApiTest::Base fixtures :trackers - def setup - Setting.rest_api_enabled = '1' - end - test "GET /trackers.xml should return trackers" do get '/trackers.xml' diff --git a/test/integration/api_test/users_test.rb b/test/integration/api_test/users_test.rb index 89fdadaf8..22b6abeff 100644 --- a/test/integration/api_test/users_test.rb +++ b/test/integration/api_test/users_test.rb @@ -20,10 +20,6 @@ require File.expand_path('../../../test_helper', __FILE__) class Redmine::ApiTest::UsersTest < Redmine::ApiTest::Base fixtures :users, :members, :member_roles, :roles, :projects - def setup - Setting.rest_api_enabled = '1' - end - test "GET /users/:id.xml should return the user" do get '/users/2.xml' diff --git a/test/integration/api_test/versions_test.rb b/test/integration/api_test/versions_test.rb index 77fd2c0e5..a53c29b07 100644 --- a/test/integration/api_test/versions_test.rb +++ b/test/integration/api_test/versions_test.rb @@ -27,10 +27,6 @@ class Redmine::ApiTest::VersionsTest < Redmine::ApiTest::Base :enabled_modules, :versions - def setup - Setting.rest_api_enabled = '1' - end - test "GET /projects/:project_id/versions.xml should return project versions" do get '/projects/1/versions.xml' diff --git a/test/integration/api_test/wiki_pages_test.rb b/test/integration/api_test/wiki_pages_test.rb index dd4f8eba6..c320604b4 100644 --- a/test/integration/api_test/wiki_pages_test.rb +++ b/test/integration/api_test/wiki_pages_test.rb @@ -22,10 +22,6 @@ class Redmine::ApiTest::WikiPagesTest < Redmine::ApiTest::Base :enabled_modules, :wikis, :wiki_pages, :wiki_contents, :wiki_content_versions, :attachments - def setup - Setting.rest_api_enabled = '1' - end - test "GET /projects/:project_id/wiki/index.xml should return wiki pages" do get '/projects/ecookbook/wiki/index.xml' assert_response 200 diff --git a/test/test_helper.rb b/test/test_helper.rb index 27acdfc91..7ec75708e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -253,6 +253,13 @@ module Redmine # Base class for API tests class Base < ActionDispatch::IntegrationTest + def setup + Setting.rest_api_enabled = '1' + end + + def teardown + Setting.rest_api_enabled = '0' + end end class Routing < Redmine::RoutingTest |