A Couple of Unit Tests

This commit is contained in:
Jacques Distler 2007-09-23 00:03:58 -05:00
parent e8769c0b83
commit 1259e16a4a
2 changed files with 13 additions and 0 deletions

View file

@ -19,4 +19,11 @@ class CategoryTest < Test::Unit::TestCase
) )
end end
def test_multiple_categories_sanitized
match(Category, 'category: test, multiple,<span>a & b</span> <script>alert("XSS!");</script>', :list => ['test', 'multiple', '&lt;span&gt;a &amp; b&lt;/span&gt; &lt;script&gt;alert(&quot;XSS!&quot;);&lt;/script&gt;'], :hidden => nil)
match(Category, 'category : chunk test , multi category,<span>a & b</span> <script>alert("XSS!");</script>',
:list => ['chunk test','multi category','&lt;span&gt;a &amp; b&lt;/span&gt; &lt;script&gt;alert(&quot;XSS!&quot;);&lt;/script&gt;'], :hidden => nil
)
end
end end

View file

@ -12,4 +12,10 @@ class NoWikiTest < Test::Unit::TestCase
) )
end end
def test_sanitized_nowiki
match(NoWiki, 'This sentence contains <nowiki><span>a & b</span> <script>alert("XSS!");</script></nowiki>. Do not touch!',
:plain_text => '<span>a &amp; b</span> &lt;script&gt;alert("XSS!");&lt;/script&gt;'
)
end
end end