This commit is contained in:
karel.picman@lbcfree.net 2021-02-19 10:37:51 +01:00
parent a8e59f34e0
commit ea8a0b3680
5 changed files with 35 additions and 4 deletions

View File

@ -31,6 +31,10 @@ source 'https://rubygems.org' do
unless %w(easyproject easy_gantt).any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) } unless %w(easyproject easy_gantt).any? { |plugin| Dir.exist?(File.expand_path("../../#{plugin}", __FILE__)) }
gem 'redmine_extensions', '~> 0.3.9' gem 'redmine_extensions', '~> 0.3.9'
gem 'rubyzip', '>= 1.1.3' gem 'rubyzip', '>= 1.1.3'
group :test do
gem 'rails-controller-testing'
end
end end
# Dav4Rack # Dav4Rack

View File

@ -124,10 +124,6 @@ module RedmineDmsf
false false
end end
# def deleted
# 0
# end
end end
end end

View File

@ -346,4 +346,20 @@ class DmsfControllerTest < RedmineDmsf::Test::TestCase
assert_redirected_to dmsf_folder_path(id: @project1, folder_id: @folder1) assert_redirected_to dmsf_folder_path(id: @project1, folder_id: @folder1)
end end
def test_show_with_sub_projects
Setting.clear_cache
Setting.plugin_redmine_dmsf['dmsf_projects_as_subfolders'] = '1'
get :show, params: { id: @project1.id }
assert_response :success
# @project3 is as a sub-folder
assert_select "tr##{@project3.id}pspan", count: 1
end
def test_show_without_sub_projects
get :show, params: { id: @project1.id }
assert_response :success
# @project3 is not as a sub-folder
assert_select "tr##{@project3.id}pspan", count: 0
end
end end

View File

@ -50,10 +50,12 @@ module RedmineDmsf
@someone = User.find_by(login: 'someone') @someone = User.find_by(login: 'someone')
@project1 = Project.find 1 @project1 = Project.find 1
Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = '1' Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = '1'
Setting.plugin_redmine_dmsf['dmsf_projects_as_subfolders'] = nil
@project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1) @project1_name = RedmineDmsf::Webdav::ProjectResource.create_project_name(@project1)
@project1_uri = Addressable::URI.escape(@project1_name) @project1_uri = Addressable::URI.escape(@project1_name)
@project2 = Project.find 2 @project2 = Project.find 2
@project3 = Project.find 3 @project3 = Project.find 3
@project4 = Project.find 4
[@project1, @project2, @project3].each do |project| [@project1, @project2, @project3].each do |project|
project.enable_module! :dmsf project.enable_module! :dmsf
project.enable_module! :issue_tracking project.enable_module! :issue_tracking
@ -88,6 +90,7 @@ module RedmineDmsf
Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] = 'WEBDAV_READ_WRITE' Setting.plugin_redmine_dmsf['dmsf_webdav_strategy'] = 'WEBDAV_READ_WRITE'
Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = nil Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names'] = nil
Setting.plugin_redmine_dmsf['dmsf_storage_directory'] = File.join(%w(files dmsf)) Setting.plugin_redmine_dmsf['dmsf_storage_directory'] = File.join(%w(files dmsf))
Setting.plugin_redmine_dmsf['dmsf_projects_as_subfolders'] = nil
Setting.text_formatting = 'Textile' Setting.text_formatting = 'Textile'
FileUtils.cp_r File.join(File.expand_path('../fixtures/files', __FILE__), '.'), DmsfFile.storage_path FileUtils.cp_r File.join(File.expand_path('../fixtures/files', __FILE__), '.'), DmsfFile.storage_path
User.current = nil User.current = nil

View File

@ -90,4 +90,16 @@ class ProjectPatchTest < RedmineDmsf::Test::UnitTest
assert_equal 0, @project3.url_links.visible.all.size assert_equal 0, @project3.url_links.visible.all.size
end end
def test_dmsf_avaliable
# @project1
# L @project3
assert @project1.dmsf_available?
assert @project3.dmsf_available?
@project1.disable_module! :dmsf
assert @project3.dmsf_available?
@project3.disable_module! :dmsf
@project3.reload
assert !@project3.dmsf_available?
end
end end