123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- require './t/test.pl';
- package OddMuse;
- use Test::More tests => 16;
- use utf8;
- add_module('questionasker.pl');
- test_page(get_page('action=edit id=test'),
- 'you must answer this question');
- test_page_negative(update_page('test', 'edit allowed'),
- 'edit allowed');
- test_page_negative(update_page('test', 'cheating using preview', '', 0, 0, 'Preview=1'),
- 'cheating using preview');
- test_page_negative($redirect, 'question%251e1');
- test_page(update_page('test', 'answer question 1', undef, undef, undef,
- 'question_num=1', 'answer=4'),
- 'answer question 1');
- test_page($redirect, 'question%251e1');
- test_page(update_page('test', 'admin can edit', undef, undef, 1),
- 'admin can edit');
- test_page_negative($redirect, 'question%251e1');
- test_page(update_page('test', 'override', undef, undef, undef, "question=1"),
- 'override');
- AppendStringToFile($ConfigFile, "\$QuestionaskerSecretKey = 'fnord';\n"
- . "\$CommentsPrefix = 'Comments on ';\n"
- . "\@QuestionaskerQuestions = "
- . "(['say hi' => sub { shift =~ /^hi\$/i }]);\n");
- test_page_negative(update_page('test', 'using old key', undef, undef, undef,
- "question=1"),
- 'using old key');
- test_page(update_page('test', 'correct key', undef, undef, undef,
- "fnord=1"),
- 'correct key');
- test_page($redirect, 'fnord%251e1');
- test_page(update_page('test', 'answer new question', undef, undef, undef,
- 'question_num=0', 'answer=hi'),
- 'answer new question');
- test_page(get_page('Comments_on_test'),
- 'label for="username"',
- 'say hi');
- update_page('Umlaute', '<Schröder>');
- test_page($redirect, '<Schröder>')
|