Some Tests for Philip Taylor Phun 'n Games

Some tests for the illegal Unicode characters in search queries (and elsewhere).
This commit is contained in:
Jacques Distler 2008-01-02 02:33:05 -06:00
parent c8196cbe41
commit c89aeb6665

View file

@ -632,6 +632,28 @@ class WikiControllerTest < Test::Unit::TestCase
assert_equal [], r.template_objects['title_results'] assert_equal [], r.template_objects['title_results']
end end
def test_search_null_in_query
r = process 'search', 'web' => 'wiki1', 'query' => "\x00"
assert_response(400)
assert_match /Your query string was not valid utf-8/, r.body
end
def test_search_FFFF_in_query
r = process 'search', 'web' => 'wiki1', 'query' => "\xEF\xBF\xBF"
assert_response(400)
assert_match /Your query string was not valid utf-8/, r.body
end
def test_search_FFFD_in_query
r = process 'search', 'web' => 'wiki1', 'query' => "\xEF\xBF\xBD"
assert_response(:success)
assert_equal [], r.template_objects['results']
assert_equal [], r.template_objects['title_results']
end
def test_show_page def test_show_page
r = process 'show', 'id' => 'Oak', 'web' => 'wiki1' r = process 'show', 'id' => 'Oak', 'web' => 'wiki1'
assert_response :success assert_response :success