From edc3596be8b5eac6f95701782edaa15a4646a165 Mon Sep 17 00:00:00 2001 From: "karel.picman@lbcfree.net" Date: Tue, 2 Feb 2021 14:46:49 +0100 Subject: [PATCH] #1133 run litmus tests on travis --- lib/tasks/dmsf_webdav_test.rake | 53 +++++++++++++++++++++++++++++++++ test/ci/projects.xml | 6 ---- test/ci/redmine_install.sh | 10 +++---- 3 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 lib/tasks/dmsf_webdav_test.rake delete mode 100644 test/ci/projects.xml diff --git a/lib/tasks/dmsf_webdav_test.rake b/lib/tasks/dmsf_webdav_test.rake new file mode 100644 index 00000000..381e618e --- /dev/null +++ b/lib/tasks/dmsf_webdav_test.rake @@ -0,0 +1,53 @@ +# encoding: utf-8 +# frozen_string_literal: true +# +# Redmine plugin for Document Management System "Features" +# +# Copyright © 2011-21 Karel Pičman +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +desc <<-END_DESC +DMSF WebDAV test task + * Create a test project with DMSF module enabled + * Enable REST API in settings + * Enable WebDAV in plugin's settings + +Example: + rake redmine:dmsf_webdav_test_on RAILS_ENV="test" + rake redmine:dmsf_webdav_test_off RAILS_ENV="test" +END_DESC + +namespace :redmine do + task :dmsf_webdav_test_on => :environment do + prj = Project.new + prj.identifier = 'dmsf_test_project' + prj.name = 'DMFS Test Project' + prj.enable_module! :dmsf + prj.save + # Settings + Settings.rest_api_enabled = true + # Plugin's settings + Setting.plugin_redmine_dmsf['dmsf_webdav'] = '1' + 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_storage_directory'] = File.join(%w(files dmsf)) + end + + task :dmsf_webdav_test_off => :environment do + prj = Project.find_by(identifier: 'dmsf_test_project') + prj&.delete + end +end diff --git a/test/ci/projects.xml b/test/ci/projects.xml deleted file mode 100644 index b704e8ec..00000000 --- a/test/ci/projects.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - c1 - c1 - dmsf - diff --git a/test/ci/redmine_install.sh b/test/ci/redmine_install.sh index 84e4e679..5fd94416 100644 --- a/test/ci/redmine_install.sh +++ b/test/ci/redmine_install.sh @@ -51,12 +51,12 @@ test() # Litmus # Run Webrick server bundle exec rails server webrick -e test -d - # Create a test project with DMS enabled via REST API - cp "${PATH_TO_DMSF}/test/ci/projects.xml" . - curl -v -H "Content-Type: application/xml" -X POST --data "@projects.xml" -u admin:admin http://localhost:3000/create.xml - rm projects.xml + # Prepare Redmine's environment for WebDAV testing + bundle exec rake redmine:dmsf_webdav_test_on RAILS_ENV="test" # Run Litmus tests - litmus http://localhost:3000/dmsf/webdav/c1 admin admin + litmus http://localhost:3000/dmsf/webdav/dmsf_test_project admin admin + # Clean up Redmine's environment from WebDAV testing + bundle exec rake redmine:dmsf_webdav_test_off RAILS_ENV="test" # Shutdown Webrick kill `cat tmp/pids/server.pid` }