wiki.pl: Port some fixes from upstream
[Orgmuse.git] / t / recaptcha.t
blob1638c4565e9a96bf3bee23ed84bbf15782afbf02
1 # Copyright (C) 2013  Alex Schroeder <alex@gnu.org>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 require 't/test.pl';
17 package OddMuse;
18 use Test::More tests => 5;
19 use utf8; # test data is UTF-8 and it matters
21 clear_pages();
22 $ENV{'REMOTE_ADDR'}='127.0.0.1';
23 add_module('recaptcha.pl');
25 # The recaptcha module used to corrupt UTF-8 encoding and HTML
26 # escaping.
28 # non-existing page and no permission
29 test_page(get_page('title=SandBox text="<b>K%C3%BChlschrank</b>"'),
30           'Status: 403',
31           '&lt;b&gt;Kühlschrank&lt;/b&gt;');
32 # update it as an admin
33 test_page(update_page('SandBox', '<b>Kühlschrank</b>', undef, undef, 1),
34           '&lt;b&gt;Kühlschrank&lt;/b&gt;');
35 # existing page and no permission
36 test_page(get_page('title=SandBox text="<b>K%C3%BChlschrank-test</b>"'),
37           'Status: 403',
38           '&lt;b&gt;Kühlschrank-test&lt;/b&gt;');