2016-11-11 15:57:25 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
require 'test_helper'
|
|
|
|
|
|
|
|
class NotificationFactoryRendererTest < ActiveSupport::TestCase
|
|
|
|
|
|
|
|
# RSpec incoming!
|
|
|
|
def described_class
|
|
|
|
NotificationFactory::Renderer
|
|
|
|
end
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
group = Group.new(name: 'Users')
|
2017-03-31 06:54:05 +00:00
|
|
|
owner = User.new(firstname: 'Owner<b>xxx</b>', lastname: 'Agent1<b>yyy</b>')
|
2016-11-13 18:33:12 +00:00
|
|
|
current_user = User.new(firstname: 'CurrentUser<b>xxx</b>', lastname: 'Agent2<b>yyy</b>')
|
|
|
|
recipient = User.new(firstname: 'Recipient<b>xxx</b>', lastname: 'Customer1<b>yyy</b>')
|
|
|
|
state = Ticket::State.new(name: 'new')
|
|
|
|
ticket = Ticket.new(
|
|
|
|
id: 1,
|
|
|
|
title: '<b>Welcome to Zammad!</b>',
|
|
|
|
group: group,
|
|
|
|
owner: owner,
|
|
|
|
state: state,
|
2017-03-31 06:54:05 +00:00
|
|
|
created_by: current_user,
|
|
|
|
updated_by: current_user,
|
2016-11-13 18:33:12 +00:00
|
|
|
created_at: Time.zone.parse('2016-11-12 12:00:00 UTC'),
|
|
|
|
updated_at: Time.zone.parse('2016-11-12 14:00:00 UTC'),
|
|
|
|
)
|
|
|
|
article_html1 = Ticket::Article.new(
|
|
|
|
body: 'test <b>hello</b><br>some new line',
|
|
|
|
content_type: 'text/html',
|
|
|
|
)
|
|
|
|
article_plain1 = Ticket::Article.new(
|
|
|
|
body: "test <b>hello</b>\nsome new line",
|
|
|
|
content_type: 'text/plain',
|
|
|
|
)
|
|
|
|
article_plain2 = Ticket::Article.new(
|
|
|
|
body: "test <b>hello</b>\nsome new line",
|
|
|
|
)
|
2016-11-11 15:57:25 +00:00
|
|
|
|
|
|
|
test 'replace object attribute' do
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.title}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML(ticket.title), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.created_at}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(ticket.created_at.to_s, result)
|
|
|
|
|
2017-03-31 06:54:05 +00:00
|
|
|
template = "\#{ticket.created_by.firstname}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('CurrentUser<b>xxx</b>', result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.updated_at}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(ticket.updated_at.to_s, result)
|
|
|
|
|
2017-03-31 06:54:05 +00:00
|
|
|
template = "\#{ticket.updated_by.firstname}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('CurrentUser<b>xxx</b>', result)
|
|
|
|
|
|
|
|
template = "\#{ticket.owner.firstname}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('Owner<b>xxx</b>', result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket. title}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML(ticket.title), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\n title}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML(ticket.title), result)
|
2016-11-11 15:57:25 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\t title}"
|
2016-11-11 15:57:25 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-12 10:19:15 +00:00
|
|
|
assert_equal(CGI.escapeHTML(ticket.title), result)
|
2016-11-11 15:57:25 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\t\n title\t}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-11 15:57:25 +00:00
|
|
|
assert_equal(CGI.escapeHTML(ticket.title), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\" title\t}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML(ticket.title), result)
|
|
|
|
|
|
|
|
template = "some test<br>\#{article.body}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
article: article_html1,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('some test<br>> test hello<br>> some new line<br>', result)
|
|
|
|
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
article: article_plain1,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('some test<br>> test <b>hello</b><br>> some new line<br>', result)
|
|
|
|
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
article: article_plain2,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('some test<br>> test <b>hello</b><br>> some new line<br>', result)
|
|
|
|
|
2016-11-11 15:57:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'config' do
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
setting = 'fqdn'
|
|
|
|
template = "\#{config.#{setting}}"
|
2016-11-11 15:57:25 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(Setting.get(setting), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
|
|
|
setting1 = 'fqdn'
|
|
|
|
setting2 = 'product_name'
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "some \#{config.#{setting1}} and \#{config.#{setting2}}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal("some #{Setting.get(setting1)} and #{Setting.get(setting2)}", result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
setting1 = 'fqdn'
|
|
|
|
setting2 = 'product_name'
|
|
|
|
template = "some \#{ config.#{setting1}} and \#{\tconfig.#{setting2}}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-12 10:19:15 +00:00
|
|
|
assert_equal("some #{Setting.get(setting1)} and #{Setting.get(setting2)}", result)
|
2016-11-11 15:57:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'translation' do
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
#template = "<%= t 'new' %>"
|
|
|
|
template = "\#{t('new')}"
|
2016-11-11 15:57:25 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'de-de',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('neu', result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "some text \#{t('new')} and \#{t('open')}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'de-de',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal('some text neu and offen', result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "some text \#{t('new') } and \#{ t('open')}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'de-de',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal('some text neu and offen', result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "some text \#{\nt('new') } and \#{ t('open')\t}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'de-de',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-12 10:19:15 +00:00
|
|
|
assert_equal('some text neu and offen', result)
|
|
|
|
|
2016-11-11 15:57:25 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test 'chained function calls' do
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{t(ticket.state.name)}"
|
2016-11-11 15:57:25 +00:00
|
|
|
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'de-de',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
|
|
|
|
assert_equal('neu', result)
|
|
|
|
end
|
2016-11-12 10:19:15 +00:00
|
|
|
|
|
|
|
test 'not existing object and attribute' do
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{no such object}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{notexsiting.notexsiting}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{notexsiting / no such object}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.notexsiting}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.notexsiting / no such method}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket. / no such method}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.title.notexsiting}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.title.notexsiting / no such method}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.notexsiting.notexsiting}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.notexsiting / no such method}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{notexsiting}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{notexsiting / no such object}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{notexsiting.}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{notexsiting / no such object}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{string}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
string: 'some string',
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('some string'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{fixum}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
fixum: 123,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('123'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{float}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
float: 123.99,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('123.99'), result)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
test 'data key validation' do
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.title `echo 1`}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.title`echo1` / not allowed}'), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.destroy}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.destroy / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.save}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.save / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.update}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.update / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.create}"
|
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.create / not allowed}'), result)
|
|
|
|
|
|
|
|
template = "\#{ticket.delete}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.delete / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.remove}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.remove / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.drop}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.drop / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.create}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.create / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.new}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.new / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.update_att}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.update_att / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.all}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.all / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.find}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.find / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.where}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.where / not allowed}'), result)
|
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket. destroy}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal(CGI.escapeHTML('#{ticket.destroy / not allowed}'), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\n destroy}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal(CGI.escapeHTML("\#{ticket.destroy / not allowed}"), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\t destroy}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal(CGI.escapeHTML("\#{ticket.destroy / not allowed}"), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
2016-11-13 18:33:12 +00:00
|
|
|
template = "\#{ticket.\r destroy}"
|
2016-11-12 10:19:15 +00:00
|
|
|
result = described_class.new(
|
|
|
|
{
|
|
|
|
ticket: ticket,
|
|
|
|
},
|
|
|
|
'en-us',
|
|
|
|
template,
|
|
|
|
).render
|
2016-11-13 18:33:12 +00:00
|
|
|
assert_equal(CGI.escapeHTML("\#{ticket.destroy / not allowed}"), result)
|
2016-11-12 10:19:15 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2016-11-11 15:57:25 +00:00
|
|
|
end
|