Maintenance: Fix HtmlSanitizer timeout stubbing in minitest.
This commit is contained in:
parent
91e108fc97
commit
65bd4c7ce7
2 changed files with 18 additions and 12 deletions
|
@ -4,10 +4,16 @@ require 'test_helper'
|
||||||
|
|
||||||
class HtmlSanitizerTest < ActiveSupport::TestCase
|
class HtmlSanitizerTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
processing_timeout = HtmlSanitizer.const_get(:PROCESSING_TIMEOUT)
|
setup do
|
||||||
|
@processing_timeout = HtmlSanitizer.const_get(:PROCESSING_TIMEOUT)
|
||||||
|
|
||||||
# XSS processing may run into a timeout on slow CI systems, so turn the timeout off for the test.
|
# XSS processing may run into a timeout on slow CI systems, so turn the timeout off for the test.
|
||||||
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, nil)
|
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, @processing_timeout)
|
||||||
|
end
|
||||||
|
|
||||||
test 'xss' do
|
test 'xss' do
|
||||||
assert_equal(HtmlSanitizer.strict('<b>123</b>'), '<b>123</b>')
|
assert_equal(HtmlSanitizer.strict('<b>123</b>'), '<b>123</b>')
|
||||||
|
@ -158,6 +164,4 @@ test 123
|
||||||
|
|
||||||
assert_equal(HtmlSanitizer.strict('<a href="mailto:testäöü@example.com" id="123">test</a>'), '<a href="mailto:test%C3%A4%C3%B6%C3%BC@example.com">test</a>')
|
assert_equal(HtmlSanitizer.strict('<a href="mailto:testäöü@example.com" id="123">test</a>'), '<a href="mailto:test%C3%A4%C3%B6%C3%BC@example.com">test</a>')
|
||||||
end
|
end
|
||||||
|
|
||||||
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, processing_timeout)
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,13 +4,17 @@ require 'test_helper'
|
||||||
|
|
||||||
class TicketTriggerTest < ActiveSupport::TestCase
|
class TicketTriggerTest < ActiveSupport::TestCase
|
||||||
|
|
||||||
processing_timeout = HtmlSanitizer.const_get(:PROCESSING_TIMEOUT)
|
|
||||||
|
|
||||||
# XSS processing may run into a timeout on slow CI systems, so turn the timeout off for the test.
|
|
||||||
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, 0.0001)
|
|
||||||
|
|
||||||
setup do
|
setup do
|
||||||
Setting.set('ticket_trigger_recursive', true)
|
Setting.set('ticket_trigger_recursive', true)
|
||||||
|
|
||||||
|
@processing_timeout = HtmlSanitizer.const_get(:PROCESSING_TIMEOUT)
|
||||||
|
|
||||||
|
# XSS processing may run into a timeout on slow CI systems, so turn the timeout off for the test.
|
||||||
|
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
teardown do
|
||||||
|
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, @processing_timeout)
|
||||||
end
|
end
|
||||||
|
|
||||||
test '1 basic' do
|
test '1 basic' do
|
||||||
|
@ -4688,6 +4692,4 @@ class TicketTriggerTest < ActiveSupport::TestCase
|
||||||
assert_match('Thanks for your inquiry (Online-apotheke. Günstigster Preis. Ohne Rezepte)!', article1.subject)
|
assert_match('Thanks for your inquiry (Online-apotheke. Günstigster Preis. Ohne Rezepte)!', article1.subject)
|
||||||
assert_equal(0, article1.attachments.count)
|
assert_equal(0, article1.attachments.count)
|
||||||
end
|
end
|
||||||
|
|
||||||
HtmlSanitizer.const_set(:PROCESSING_TIMEOUT, processing_timeout)
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue