Files
oddmuse/t/recaptcha.t
Alex Schroeder b0f9722857 recaptcha.t: use Captcha::reCAPTCHA always
This module is no longer optional. The test will not skip.
2015-10-12 15:09:15 +02:00

50 lines
1.7 KiB
Perl
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Copyright (C) 20132015 Alex Schroeder <alex@gnu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
require 't/test.pl';
package OddMuse;
use Test::More tests => 7;
use utf8; # test data is UTF-8 and it matters
use Captcha::reCAPTCHA;
$ENV{'REMOTE_ADDR'}='127.0.0.1';
add_module('recaptcha.pl');
# The recaptcha module used to corrupt UTF-8 encoding and HTML
# escaping.
# non-existing page and no permission
test_page(get_page('title=SandBox text="<b>K%C3%BChlschrank</b>"'),
'Status: 403',
'&lt;b&gt;Kühlschrank&lt;/b&gt;');
# update it as an admin
test_page(update_page('SandBox', '<b>Kühlschrank</b>', undef, undef, 1),
'&lt;b&gt;Kühlschrank&lt;/b&gt;');
# existing page and no permission
$page = get_page('title=SandBox text="<b>K%C3%BChlschrank-test</b>"');
test_page($page,
'Status: 403',
'&lt;b&gt;Kühlschrank-test&lt;/b&gt;');
# edit form is modified by recaptcha
test_page($page, 'var RecaptchaOptions');
# comment form is modified by recaptcha
AppendStringToFile($ConfigFile, "\$CommentsPrefix = 'Comments on ';\n");
test_page(get_page('Comments_on_SandBox'),
'var RecaptchaOptions');