From c89aeb66651d03040331e94f8bf8ddd596e55780 Mon Sep 17 00:00:00 2001 From: Jacques Distler Date: Wed, 2 Jan 2008 02:33:05 -0600 Subject: [PATCH] Some Tests for Philip Taylor Phun 'n Games Some tests for the illegal Unicode characters in search queries (and elsewhere). --- test/functional/wiki_controller_test.rb | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/functional/wiki_controller_test.rb b/test/functional/wiki_controller_test.rb index b3b62a2e..f28f4f0c 100755 --- a/test/functional/wiki_controller_test.rb +++ b/test/functional/wiki_controller_test.rb @@ -632,6 +632,28 @@ class WikiControllerTest < Test::Unit::TestCase assert_equal [], r.template_objects['title_results'] 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 r = process 'show', 'id' => 'Oak', 'web' => 'wiki1' assert_response :success