fixtures :all
This commit is contained in:
parent
02e699655b
commit
5fcede685a
2
.github/workflows/rubyonrails.yml
vendored
2
.github/workflows/rubyonrails.yml
vendored
@ -140,7 +140,9 @@ jobs:
|
|||||||
- name: Helpers tests
|
- name: Helpers tests
|
||||||
run: |
|
run: |
|
||||||
cd /opt/redmine
|
cd /opt/redmine
|
||||||
|
ruby plugins/redmine_dmsf/test/helpers/dmsf_files_helper_test.rb
|
||||||
ruby plugins/redmine_dmsf/test/helpers/dmsf_helper_test.rb
|
ruby plugins/redmine_dmsf/test/helpers/dmsf_helper_test.rb
|
||||||
|
ruby plugins/redmine_dmsf/test/helpers/dmsf_links_helper_test.rb
|
||||||
ruby plugins/redmine_dmsf/test/helpers/dmsf_queries_helper_test.rb
|
ruby plugins/redmine_dmsf/test/helpers/dmsf_queries_helper_test.rb
|
||||||
- name: Rubocop
|
- name: Rubocop
|
||||||
# Run the Rubocop tests
|
# Run the Rubocop tests
|
||||||
|
|||||||
@ -26,8 +26,7 @@ AllCops:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- '**/vendor/**/*'
|
- '**/vendor/**/*'
|
||||||
|
|
||||||
# Enable extensions
|
plugins:
|
||||||
require:
|
|
||||||
- rubocop-performance
|
- rubocop-performance
|
||||||
- rubocop-rails
|
- rubocop-rails
|
||||||
|
|
||||||
|
|||||||
@ -117,6 +117,7 @@ module RedmineDmsf
|
|||||||
|
|
||||||
file = DmsfFile.visible.find_by(id: args[0])
|
file = DmsfFile.visible.find_by(id: args[0])
|
||||||
return "{{dmsfversion(#{args[0]})}}" unless file
|
return "{{dmsfversion(#{args[0]})}}" unless file
|
||||||
|
|
||||||
unless User.current&.allowed_to?(:view_dmsf_files, file.project, { id: file.id })
|
unless User.current&.allowed_to?(:view_dmsf_files, file.project, { id: file.id })
|
||||||
raise ::I18n.t(:notice_not_authorized)
|
raise ::I18n.t(:notice_not_authorized)
|
||||||
end
|
end
|
||||||
@ -127,7 +128,7 @@ module RedmineDmsf
|
|||||||
revision = DmsfFileRevision.find_by(id: args[1], dmsf_file_id: args[0])
|
revision = DmsfFileRevision.find_by(id: args[1], dmsf_file_id: args[0])
|
||||||
return "{{dmsfversion(#{args[0]}, #{args[1]})}}" unless revision
|
return "{{dmsfversion(#{args[0]}, #{args[1]})}}" unless revision
|
||||||
end
|
end
|
||||||
textilizable revision.version
|
revision.version
|
||||||
end
|
end
|
||||||
|
|
||||||
# dmsflastupdate - text referring to the document's last update date
|
# dmsflastupdate - text referring to the document's last update date
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfContextMenusControllerTest < RedmineDmsf::Test::TestCase
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_links, :dmsf_locks
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@file_link2 = DmsfLink.find 2
|
@file_link2 = DmsfLink.find 2
|
||||||
|
|||||||
@ -25,9 +25,6 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase
|
|||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
include DmsfHelper
|
include DmsfHelper
|
||||||
|
|
||||||
fixtures :custom_fields, :custom_values, :dmsf_links, :dmsf_folder_permissions, :dmsf_locks,
|
|
||||||
:dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@link2 = DmsfLink.find 2
|
@link2 = DmsfLink.find 2
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# DmsfFiles controller
|
# DmsfFiles controller
|
||||||
class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfFilesControllerTest < RedmineDmsf::Test::TestCase
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
|
||||||
|
|
||||||
def teardown
|
def teardown
|
||||||
super
|
super
|
||||||
DmsfFile.clear_previews
|
DmsfFile.clear_previews
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Folder permissions controller
|
# Folder permissions controller
|
||||||
class DmsfFolderPermissionsControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfFolderPermissionsControllerTest < RedmineDmsf::Test::TestCase
|
||||||
fixtures :dmsf_folder_permissions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Help controller
|
# Help controller
|
||||||
class DmsfHelpControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfHelpControllerTest < RedmineDmsf::Test::TestCase
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_wiki_syntax
|
def test_wiki_syntax
|
||||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||||
get '/dmsf/help/wiki_syntax'
|
get '/dmsf/help/wiki_syntax'
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfLinksControllerTest < RedmineDmsf::Test::TestCase
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_links, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@file_link = DmsfLink.find 1
|
@file_link = DmsfLink.find 1
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Public URL controller
|
# Public URL controller
|
||||||
class DmsfPublicUrlsControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfPublicUrlsControllerTest < RedmineDmsf::Test::TestCase
|
||||||
fixtures :dmsf_public_urls, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_show_valid_url
|
def test_show_valid_url
|
||||||
get '/dmsf_public_urls', params: { token: 'd8d33e21914a433b280fdc94450ee212' }
|
get '/dmsf_public_urls', params: { token: 'd8d33e21914a433b280fdc94450ee212' }
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfStateControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfStateControllerTest < RedmineDmsf::Test::TestCase
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :queries
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@query401 = Query.find 401
|
@query401 = Query.find 401
|
||||||
|
|||||||
@ -23,9 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase
|
class DmsfWorkflowsControllerTest < RedmineDmsf::Test::TestCase
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments,
|
|
||||||
:dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@wfs1 = DmsfWorkflowStep.find 1 # step 1
|
@wfs1 = DmsfWorkflowStep.find 1 # step 1
|
||||||
|
|||||||
@ -21,10 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Issues controller
|
# Issues controller
|
||||||
class IssuesControllerTest < RedmineDmsf::Test::TestCase
|
class IssuesControllerTest < RedmineDmsf::Test::TestCase
|
||||||
fixtures :user_preferences, :issues, :versions, :trackers, :projects_trackers, :issue_statuses,
|
|
||||||
:enabled_modules, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :enumerations,
|
|
||||||
:issue_categories
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@issue1 = Issue.find 1
|
@issue1 = Issue.find 1
|
||||||
|
|||||||
@ -23,9 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class MyControllerTest < RedmineDmsf::Test::TestCase
|
class MyControllerTest < RedmineDmsf::Test::TestCase
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :user_preferences, :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments,
|
|
||||||
:dmsf_workflow_step_actions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
|
||||||
|
|
||||||
def test_page_with_open_approvals_one_approval
|
def test_page_with_open_approvals_one_approval
|
||||||
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
post '/login', params: { username: 'jsmith', password: 'jsmith' }
|
||||||
DmsfFileRevision.where(id: 5).delete_all
|
DmsfFileRevision.where(id: 5).delete_all
|
||||||
|
|||||||
@ -21,23 +21,16 @@ module RedmineDmsf
|
|||||||
module Test
|
module Test
|
||||||
# Helper test
|
# Helper test
|
||||||
class HelperTest < ActiveSupport::TestCase
|
class HelperTest < ActiveSupport::TestCase
|
||||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
def initialize(name)
|
||||||
|
super(name)
|
||||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
# Load all plugin's fixtures
|
||||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
|
||||||
# and allowing us to suppliment redmine fixtures if we need to.
|
|
||||||
def self.fixtures(*table_names)
|
|
||||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
redmine_table_names = []
|
ext = '.yml'
|
||||||
table_names.each do |x|
|
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
fixture = File.basename(file, ext)
|
||||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||||
else
|
|
||||||
redmine_table_names << x
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
super(redmine_table_names) if redmine_table_names.any?
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@jsmith = User.find 2
|
@jsmith = User.find 2
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfHelperTest < RedmineDmsf::Test::HelperTest
|
class DmsfHelperTest < RedmineDmsf::Test::HelperTest
|
||||||
include DmsfHelper
|
include DmsfHelper
|
||||||
|
|
||||||
fixtures :dmsf_folders
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@folder1 = DmsfFolder.find 1
|
@folder1 = DmsfFolder.find 1
|
||||||
|
|||||||
@ -25,8 +25,6 @@ class DmsfQueriesHelperTest < RedmineDmsf::Test::HelperTest
|
|||||||
include ActionView::Helpers::NumberHelper
|
include ActionView::Helpers::NumberHelper
|
||||||
include ActionView::Helpers::TagHelper
|
include ActionView::Helpers::TagHelper
|
||||||
|
|
||||||
fixtures :dmsf_folders
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@folder1 = DmsfFolder.find 1
|
@folder1 = DmsfFolder.find 1
|
||||||
super
|
super
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks, :dmsf_links
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
Setting.rest_api_enabled = '1'
|
Setting.rest_api_enabled = '1'
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_files, :dmsf_file_revisions, :dmsf_locks, :custom_fields
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
Setting.rest_api_enabled = '1'
|
Setting.rest_api_enabled = '1'
|
||||||
|
|||||||
@ -23,9 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks, :dmsf_links, :custom_fields,
|
|
||||||
:custom_values
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
Setting.rest_api_enabled = '1'
|
Setting.rest_api_enabled = '1'
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
class DmsfLinkApiTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfLinkApiTest < RedmineDmsf::Test::IntegrationTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_files, :dmsf_file_revisions, :dmsf_links
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
Setting.rest_api_enabled = '1'
|
Setting.rest_api_enabled = '1'
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Custom middleware test
|
# Custom middleware test
|
||||||
class DmsfWebdavCustomMiddlewareTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavCustomMiddlewareTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files
|
|
||||||
|
|
||||||
def test_options_for_root_path
|
def test_options_for_root_path
|
||||||
process :options, '/'
|
process :options, '/'
|
||||||
assert_response :method_not_allowed
|
assert_response :method_not_allowed
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavDeleteTest < RedmineDmsf::Test::IntegrationTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
|
||||||
|
|
||||||
def test_not_authenticated
|
def test_not_authenticated
|
||||||
delete '/dmsf/webdav'
|
delete '/dmsf/webdav'
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# WebDAV GET test
|
# WebDAV GET test
|
||||||
class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavGetTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_should_deny_anonymous
|
def test_should_deny_anonymous
|
||||||
get '/dmsf/webdav'
|
get '/dmsf/webdav'
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# WebDAV HEAD tests
|
# WebDAV HEAD tests
|
||||||
class DmsfWebdavHeadTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavHeadTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_head_requires_authentication
|
def test_head_requires_authentication
|
||||||
head "/dmsf/webdav/#{@project1.identifier}"
|
head "/dmsf/webdav/#{@project1.identifier}"
|
||||||
|
|||||||
@ -22,7 +22,6 @@ require 'fileutils'
|
|||||||
|
|
||||||
# WebDAV LOCK test
|
# WebDAV LOCK test
|
||||||
class DmsfWebdavLockTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavLockTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# WebDAV MKCOL tests
|
# WebDAV MKCOL tests
|
||||||
class DmsfWebdavMkcolTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavMkcolTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders
|
|
||||||
|
|
||||||
def test_mkcol_requires_authentication
|
def test_mkcol_requires_authentication
|
||||||
process :mkcol, '/dmsf/webdav/test1'
|
process :mkcol, '/dmsf/webdav/test1'
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
|
|||||||
@ -22,8 +22,6 @@ require 'fileutils'
|
|||||||
|
|
||||||
# WebDAV MOVE tests
|
# WebDAV MOVE tests
|
||||||
class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavMoveTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_move_denied_for_anonymous
|
def test_move_denied_for_anonymous
|
||||||
new_name = "#{@file1.name}.moved"
|
new_name = "#{@file1.name}.moved"
|
||||||
assert_no_difference '@file1.dmsf_file_revisions.count' do
|
assert_no_difference '@file1.dmsf_file_revisions.count' do
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# WebDAV OPTIONS tests
|
# WebDAV OPTIONS tests
|
||||||
class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavOptionsTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders
|
|
||||||
|
|
||||||
def test_options_requires_no_authentication_for_root_level
|
def test_options_requires_no_authentication_for_root_level
|
||||||
process :options, '/dmsf/webdav'
|
process :options, '/dmsf/webdav'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# WebDAV POST tests
|
# WebDAV POST tests
|
||||||
class DmsfWebdavPostTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavPostTest < RedmineDmsf::Test::IntegrationTest
|
||||||
# Test that any post request is authenticated
|
|
||||||
def test_post_request_authenticated
|
def test_post_request_authenticated
|
||||||
post '/dmsf/webdav/'
|
post '/dmsf/webdav/'
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
|
|||||||
@ -22,8 +22,6 @@ require 'uri'
|
|||||||
|
|
||||||
# WebDAV PROPFIND tests
|
# WebDAV PROPFIND tests
|
||||||
class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavPropfindTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_propfind_denied_for_anonymous
|
def test_propfind_denied_for_anonymous
|
||||||
process :propfind, '/dmsf/webdav/', params: nil, headers: @anonymous.merge!({ HTTP_DEPTH: '0' })
|
process :propfind, '/dmsf/webdav/', params: nil, headers: @anonymous.merge!({ HTTP_DEPTH: '0' })
|
||||||
assert_response :unauthorized
|
assert_response :unauthorized
|
||||||
|
|||||||
@ -22,8 +22,6 @@ require 'fileutils'
|
|||||||
|
|
||||||
# WebDAV PUT tests
|
# WebDAV PUT tests
|
||||||
class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@cv22 = CustomValue.find(22)
|
@cv22 = CustomValue.find(22)
|
||||||
|
|||||||
@ -22,8 +22,6 @@ require 'fileutils'
|
|||||||
|
|
||||||
# WebDAV UNLOCK tests
|
# WebDAV UNLOCK tests
|
||||||
class DmsfWebdavUnlockTest < RedmineDmsf::Test::IntegrationTest
|
class DmsfWebdavUnlockTest < RedmineDmsf::Test::IntegrationTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :dmsf_locks
|
|
||||||
|
|
||||||
def test_unlock_file
|
def test_unlock_file
|
||||||
log_user 'admin', 'admin'
|
log_user 'admin', 'admin'
|
||||||
l = @file2.locks.first
|
l = @file2.locks.first
|
||||||
|
|||||||
@ -21,7 +21,16 @@ module RedmineDmsf
|
|||||||
module Test
|
module Test
|
||||||
# Integration test
|
# Integration test
|
||||||
class IntegrationTest < Redmine::IntegrationTest
|
class IntegrationTest < Redmine::IntegrationTest
|
||||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
def initialize(name)
|
||||||
|
super(name)
|
||||||
|
# Load all plugin's fixtures
|
||||||
|
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
|
ext = '.yml'
|
||||||
|
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||||
|
fixture = File.basename(file, ext)
|
||||||
|
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@admin = credentials('admin', 'admin')
|
@admin = credentials('admin', 'admin')
|
||||||
@ -71,19 +80,6 @@ module RedmineDmsf
|
|||||||
Rails.logger.error e.message
|
Rails.logger.error e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.fixtures(*table_names)
|
|
||||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
|
||||||
redmine_table_names = []
|
|
||||||
table_names.each do |x|
|
|
||||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
|
||||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
|
||||||
else
|
|
||||||
redmine_table_names << x
|
|
||||||
end
|
|
||||||
end
|
|
||||||
super(redmine_table_names) if redmine_table_names.any?
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def check_headers_exist
|
def check_headers_exist
|
||||||
|
|||||||
@ -21,23 +21,16 @@ module RedmineDmsf
|
|||||||
module Test
|
module Test
|
||||||
# Test case
|
# Test case
|
||||||
class TestCase < ActionDispatch::IntegrationTest
|
class TestCase < ActionDispatch::IntegrationTest
|
||||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
def initialize(name)
|
||||||
|
super(name)
|
||||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
# Load all plugin's fixtures
|
||||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
|
||||||
# and allowing us to suppliment redmine fixtures if we need to.
|
|
||||||
def self.fixtures(*table_names)
|
|
||||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
redmine_table_names = []
|
ext = '.yml'
|
||||||
table_names.each do |x|
|
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
fixture = File.basename(file, ext)
|
||||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||||
else
|
|
||||||
redmine_table_names << x
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
super(redmine_table_names) if redmine_table_names.any?
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@admin = User.find_by(login: 'admin')
|
@admin = User.find_by(login: 'admin')
|
||||||
|
|||||||
@ -21,7 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# File revision tests
|
# File revision tests
|
||||||
class CustomFieldDmsfFileFormatTest < RedmineDmsf::Test::UnitTest
|
class CustomFieldDmsfFileFormatTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :custom_fields, :projects, :issues, :trackers
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
User.current = @jsmith
|
User.current = @jsmith
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfFileRevisionTest < RedmineDmsf::Test::UnitTest
|
class DmsfFileRevisionTest < RedmineDmsf::Test::UnitTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_locks, :dmsf_workflows, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@revision1 = DmsfFileRevision.find 1
|
@revision1 = DmsfFileRevision.find 1
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# File tests
|
# File tests
|
||||||
class DmsfFileTest < RedmineDmsf::Test::UnitTest
|
class DmsfFileTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_locks, :issues, :dmsf_links, :dmsf_workflows, :dmsf_workflow_steps,
|
|
||||||
:dmsf_workflow_step_assignments, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@issue1 = Issue.find 1
|
@issue1 = Issue.find 1
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Folder permissions tests
|
# Folder permissions tests
|
||||||
class DmsfFolderPermissionTest < RedmineDmsf::Test::UnitTest
|
class DmsfFolderPermissionTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_folder_permissions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@permission1 = DmsfFolderPermission.find 1
|
@permission1 = DmsfFolderPermission.find 1
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Folder tests
|
# Folder tests
|
||||||
class DmsfFolderTest < RedmineDmsf::Test::UnitTest
|
class DmsfFolderTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_folder_permissions, :dmsf_locks, :dmsf_folders, :dmsf_files, :dmsf_file_revisions,
|
|
||||||
:dmsf_links
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@link2 = DmsfLink.find 2
|
@link2 = DmsfLink.find 2
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Link tests
|
# Link tests
|
||||||
class DmsfLinksTest < RedmineDmsf::Test::UnitTest
|
class DmsfLinksTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_links, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values
|
|
||||||
|
|
||||||
def test_create_folder_link
|
def test_create_folder_link
|
||||||
folder_link = DmsfLink.new
|
folder_link = DmsfLink.new
|
||||||
folder_link.target_project_id = @project1.id
|
folder_link.target_project_id = @project1.id
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper.rb', __FILE__)
|
|||||||
|
|
||||||
# Lock tests
|
# Lock tests
|
||||||
class DmsfLockTest < RedmineDmsf::Test::UnitTest
|
class DmsfLockTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_locks, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@lock = DmsfLock.find 1
|
@lock = DmsfLock.find 1
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfMailerTest < RedmineDmsf::Test::UnitTest
|
class DmsfMailerTest < RedmineDmsf::Test::UnitTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_workflows, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@file1.notify_activate
|
@file1.notify_activate
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Public URL tests
|
# Public URL tests
|
||||||
class DmsfPublicUrlsTest < RedmineDmsf::Test::UnitTest
|
class DmsfPublicUrlsTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_public_urls, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@dmsf_public_url1 = DmsfPublicUrl.find 1
|
@dmsf_public_url1 = DmsfPublicUrl.find 1
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Query tests
|
# Query tests
|
||||||
class DmsfQueryTest < RedmineDmsf::Test::UnitTest
|
class DmsfQueryTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :queries, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@query401 = Query.find 401
|
@query401 = Query.find 401
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Upload tests
|
# Upload tests
|
||||||
class DmsfUploadTest < RedmineDmsf::Test::UnitTest
|
class DmsfUploadTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :projects
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@uploaded = {
|
@uploaded = {
|
||||||
|
|||||||
@ -23,9 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfWorkflowStepActionTest < RedmineDmsf::Test::UnitTest
|
class DmsfWorkflowStepActionTest < RedmineDmsf::Test::UnitTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_workflow_steps, :dmsf_workflow_step_actions, :dmsf_folders, :dmsf_files,
|
|
||||||
:dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@wfsac1 = DmsfWorkflowStepAction.find 1
|
@wfsac1 = DmsfWorkflowStepAction.find 1
|
||||||
@wfsac2 = DmsfWorkflowStepAction.find 2
|
@wfsac2 = DmsfWorkflowStepAction.find 2
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Workflow step assignment tests
|
# Workflow step assignment tests
|
||||||
class WorkflowStepAssignmentTest < RedmineDmsf::Test::UnitTest
|
class WorkflowStepAssignmentTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_workflow_steps, :dmsf_workflow_step_assignments, :dmsf_folders, :dmsf_files,
|
|
||||||
:dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@wfsa1 = DmsfWorkflowStepAssignment.find 1
|
@wfsa1 = DmsfWorkflowStepAssignment.find 1
|
||||||
@wfsa2 = DmsfWorkflowStepAssignment.find 2
|
@wfsa2 = DmsfWorkflowStepAssignment.find 2
|
||||||
|
|||||||
@ -23,8 +23,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
class DmsfWorkflowStepTest < RedmineDmsf::Test::UnitTest
|
class DmsfWorkflowStepTest < RedmineDmsf::Test::UnitTest
|
||||||
include Redmine::I18n
|
include Redmine::I18n
|
||||||
|
|
||||||
fixtures :dmsf_workflows, :dmsf_workflow_steps, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@wfs1 = DmsfWorkflowStep.find 1
|
@wfs1 = DmsfWorkflowStep.find 1
|
||||||
@wfs2 = DmsfWorkflowStep.find 2
|
@wfs2 = DmsfWorkflowStep.find 2
|
||||||
|
|||||||
@ -21,9 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Workflow tests
|
# Workflow tests
|
||||||
class DmsfWorkflowTest < RedmineDmsf::Test::UnitTest
|
class DmsfWorkflowTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_file_revisions, :dmsf_workflows, :dmsf_workflow_steps, :dmsf_workflow_step_assignments,
|
|
||||||
:dmsf_workflow_step_actions, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
super
|
super
|
||||||
@wf1 = DmsfWorkflow.find 1
|
@wf1 = DmsfWorkflow.find 1
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Issue tests
|
# Issue tests
|
||||||
class IssuePatchTest < RedmineDmsf::Test::UnitTest
|
class IssuePatchTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :issues, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@issue1 = Issue.find 1
|
@issue1 = Issue.find 1
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# Macros tests
|
# Macros tests
|
||||||
class DmsfMacrosTest < RedmineDmsf::Test::HelperTest
|
class DmsfMacrosTest < RedmineDmsf::Test::HelperTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
# Mock view context for macros
|
# Mock view context for macros
|
||||||
class DmsfView
|
class DmsfView
|
||||||
include ApplicationHelper
|
include ApplicationHelper
|
||||||
|
|||||||
@ -22,7 +22,6 @@ require File.expand_path('../../../../../lib/redmine_dmsf/dmsf_zip', __FILE__)
|
|||||||
|
|
||||||
# Plugin tests
|
# Plugin tests
|
||||||
class DmsfZipTest < RedmineDmsf::Test::HelperTest
|
class DmsfZipTest < RedmineDmsf::Test::HelperTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions, :attachments
|
|
||||||
def setup
|
def setup
|
||||||
@zip = RedmineDmsf::DmsfZip::Zip.new
|
@zip = RedmineDmsf::DmsfZip::Zip.new
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# project tests
|
# project tests
|
||||||
class ProjectPatchTest < RedmineDmsf::Test::UnitTest
|
class ProjectPatchTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_links, :dmsf_workflows, :dmsf_locks, :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_project_has_dmsf_files
|
def test_project_has_dmsf_files
|
||||||
assert @project1.respond_to?(:dmsf_files)
|
assert @project1.respond_to?(:dmsf_files)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,10 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# User tests
|
# User tests
|
||||||
class UserPatchTest < RedmineDmsf::Test::UnitTest
|
class UserPatchTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_links, :dmsf_locks, :dmsf_workflows, :dmsf_workflow_steps,
|
|
||||||
:dmsf_workflow_step_assignments, :dmsf_workflow_step_actions, :dmsf_folders,
|
|
||||||
:dmsf_files, :dmsf_file_revisions, :custom_fields, :custom_values
|
|
||||||
|
|
||||||
def test_remove_dmsf_references
|
def test_remove_dmsf_references
|
||||||
id = @jsmith.id
|
id = @jsmith.id
|
||||||
@jsmith.destroy
|
@jsmith.destroy
|
||||||
|
|||||||
@ -21,8 +21,6 @@ require File.expand_path('../../test_helper', __FILE__)
|
|||||||
|
|
||||||
# User preference tests
|
# User preference tests
|
||||||
class UserPreferencePatchTest < RedmineDmsf::Test::UnitTest
|
class UserPreferencePatchTest < RedmineDmsf::Test::UnitTest
|
||||||
fixtures :dmsf_folders, :dmsf_files, :dmsf_file_revisions
|
|
||||||
|
|
||||||
def test_user_preference_has_dmsf_attachments_upload_choice
|
def test_user_preference_has_dmsf_attachments_upload_choice
|
||||||
assert @jsmith.pref.respond_to?(:dmsf_attachments_upload_choice)
|
assert @jsmith.pref.respond_to?(:dmsf_attachments_upload_choice)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,7 +21,16 @@ module RedmineDmsf
|
|||||||
module Test
|
module Test
|
||||||
# Unit test
|
# Unit test
|
||||||
class UnitTest < ActiveSupport::TestCase
|
class UnitTest < ActiveSupport::TestCase
|
||||||
fixtures :users, :email_addresses, :projects, :roles, :members, :member_roles
|
def initialize(name)
|
||||||
|
super(name)
|
||||||
|
# Load all plugin's fixtures
|
||||||
|
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
||||||
|
ext = '.yml'
|
||||||
|
Dir.glob("#{dir}/**/*#{ext}").each do |file|
|
||||||
|
fixture = File.basename(file, ext)
|
||||||
|
ActiveRecord::FixtureSet.create_fixtures dir, fixture
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@admin = User.find_by(login: 'admin')
|
@admin = User.find_by(login: 'admin')
|
||||||
@ -71,22 +80,6 @@ module RedmineDmsf
|
|||||||
Rails.logger.error e.message
|
Rails.logger.error e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
# Allow us to override the fixtures method to implement fixtures for our plugin.
|
|
||||||
# Ultimately it allows for better integration without blowing redmine fixtures up,
|
|
||||||
# and allowing us to suppliment redmine fixtures if we need to.
|
|
||||||
def self.fixtures(*table_names)
|
|
||||||
dir = File.join(File.dirname(__FILE__), 'fixtures')
|
|
||||||
redmine_table_names = []
|
|
||||||
table_names.each do |x|
|
|
||||||
if File.exist?(File.join(dir, "#{x}.yml"))
|
|
||||||
ActiveRecord::FixtureSet.create_fixtures(dir, x)
|
|
||||||
else
|
|
||||||
redmine_table_names << x
|
|
||||||
end
|
|
||||||
end
|
|
||||||
super(redmine_table_names) if redmine_table_names.any?
|
|
||||||
end
|
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def last_email
|
def last_email
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user