Unit test fixes

This commit is contained in:
karel.picman@lbcfree.net 2021-05-18 13:19:06 +02:00
parent b687119d1d
commit 293bda4397
5 changed files with 12 additions and 12 deletions

View File

@ -300,8 +300,8 @@ class DmsfWorkflowsController < ApplicationController
def update
if params[:dmsf_workflow]
res = @dmsf_workflow.update_attributes({ name: params[:dmsf_workflow][:name] }) if params[:dmsf_workflow][:name].present?
res = @dmsf_workflow.update_attributes({ status: params[:dmsf_workflow][:status] }) if params[:dmsf_workflow][:status].present?
res = @dmsf_workflow.update(name: params[:dmsf_workflow][:name]) if params[:dmsf_workflow][:name].present?
res = @dmsf_workflow.update(status: params[:dmsf_workflow][:status]) if params[:dmsf_workflow][:status].present?
if res
flash[:notice] = l(:notice_successful_update)
if @project

View File

@ -34,7 +34,7 @@ class DmsfFolderPermissionsControllerTest < RedmineDmsf::Test::TestCase
get :new, params: { project_id: @project1, dmsf_folder_id: @folder7, format: 'js' }, xhr: true
assert_response :success
assert_template 'new'
assert_equal 'text/javascript', response.content_type
assert @response.content_type.match?(/^text\/javascript/)
end
def test_autocomplete_for_user
@ -49,7 +49,7 @@ class DmsfFolderPermissionsControllerTest < RedmineDmsf::Test::TestCase
xhr: true
assert_response :success
assert_template 'new'
assert_equal 'text/javascript', response.content_type
assert @response.content_type.match?(/^text\/javascript/)
end
end

View File

@ -36,7 +36,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
# curl -v -H "Content-Type: application/xml" -X GET -u ${1}:${2} http://localhost:3000/projects/12/dmsf.xml
get "/projects/#{@project1.id}/dmsf.xml?key=#{@token.value}"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf>
# <dmsf_nodes total_count="10" type="array">

View File

@ -36,7 +36,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
#curl -v -H "Content-Type: application/xml" -X GET -u ${1}:${2} http://localhost:3000/dmsf/files/17216.xml
get "/dmsf/files/#{@file1.id}.xml?key=#{@token.value}"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf_file>
# <id>1</id>
@ -113,7 +113,7 @@ class DmsfFileApiTest < RedmineDmsf::Test::IntegrationTest
#curl --data-binary "@cat.gif" -H "Content-Type: application/octet-stream" -X POST -u ${1}:${2} http://localhost:3000/projects/12/dmsf/upload.xml?filename=cat.gif
post "/projects/#{@project1.id}/dmsf/upload.xml?filename=test.txt&key=#{@token.value}", params: 'File content', headers: { "CONTENT_TYPE" => 'application/octet-stream' }
assert_response :created
assert_equal 'application/xml', response.content_type
assert @response.content_type.match?(/^application\/xml/)
#<?xml version="1.0" encoding="UTF-8"?>
# <upload>
# <token>2.8bb2564936980e92ceec8a5759ec34a8</token>

View File

@ -36,7 +36,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
#curl -v -H "Content-Type: application/xml" -X GET -u ${1}:${2} http://localhost:3000/dmsf/files/17216.xml
get "/projects/#{@project1.identifier}/dmsf.xml?key=#{@token.value}"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf>
# <dmsf_nodes total_count="7" type="array">
@ -58,7 +58,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
#curl -v -H "Content-Type: application/xml" -X GET -u ${1}:${2} http://localhost:3000/dmsf/files/17216.xml
get "/projects/#{@project1.identifier}/dmsf.xml?key=#{@token.value}"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf>
# <dmsf_nodes total_count="9" type="array">
@ -81,7 +81,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
#curl -v -H "Content-Type: application/xml" -X GET -u ${1}:${2} "http://localhost:3000/dmsf/files/17216.xml?limit=1&offset=1"
get "/projects/#{@project1.identifier}/dmsf.xml?key=#{@token.value}&limit=1&offset=2"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf>
# <dmsf_nodes total_count="1" type="array">
@ -120,7 +120,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
# curl -v -H "Content-Type: application/json" -X GET -H "X-Redmine-API-Key: USERS_API_KEY" http://localhost:3000/projects/1/dmsf.json?folder_title=Updated%20title
get "/projects/#{@project1.identifier}/dmsf.xml?key=#{@token.value}&folder_title=#{@folder1.title}"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf>
# <dmsf_folders total_count="1" type="array">
@ -152,7 +152,7 @@ class DmsfFolderApiTest < RedmineDmsf::Test::IntegrationTest
# curl -v -H "Content-Type: application/json" -X GET -H "X-Redmine-API-Key: USERS_API_KE" http://localhost:3000/projects/1/dmsf.json?folder_id=3
get "/projects/#{@project1.identifier}/dmsf.xml?key=#{@token.value}&folder_id=#{@folder1.id}"
assert_response :success
assert_equal 'application/xml', @response.content_type
assert @response.content_type.match?(/^application\/xml/)
# <?xml version="1.0" encoding="UTF-8"?>
# <dmsf>
# <dmsf_folders total_count="1" type="array">