1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- # Copyright (C) 2013–2019 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',
- '<b>Kühlschrank</b>');
- # update it as an admin
- test_page(update_page('SandBox', '<b>Kühlschrank</b>', undef, undef, 1),
- '<b>Kühlschrank</b>');
- # existing page and no permission
- $page = get_page('title=SandBox text="<b>K%C3%BChlschrank-test</b>"');
- test_page($page,
- 'Status: 403',
- '<b>Kühlschrank-test</b>');
- # 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');
|