private-wiki.t 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (C) 2015 Alex-Daniel Jakimenko <alex.jakimenko@gmail.com>
  2. # Copyright (C) 2015 Alex Schroeder <alex@gnu.org>
  3. #
  4. # This program is free software: you can redistribute it and/or modify it under
  5. # the terms of the GNU General Public License as published by the Free Software
  6. # Foundation, either version 3 of the License, or (at your option) any later
  7. # version.
  8. #
  9. # This program is distributed in the hope that it will be useful, but WITHOUT
  10. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License along with
  14. # this program. If not, see <http://www.gnu.org/licenses/>.
  15. require './t/test.pl';
  16. package OddMuse;
  17. use Test::More tests => 2;
  18. add_module('private-wiki.pl');
  19. open(F, '>:encoding(utf-8)', "$DataDir/config");
  20. print F "use Digest::SHA qw(sha256_hex);\n";
  21. print F "\$PassHashFunction = 'sha256_hex';\n";
  22. print F "\$PassSalt = '';\n";
  23. print F "\$AdminPass = '4207b6bc5176ab397e49c116954ca5a499f3f61c2d7556162aebf94ba25baf8a';\n";
  24. close(F);
  25. # First of all, let's test basic editing
  26. get_page('Save=1', 'title=Test', 'summary=MySummary', 'recent_edit=on', 'text=HelloPrivateWiki', 'pwd=5de2cbd1cbb2048e4c753c9fa118c130c1c8b91312154bb30bb99961bd620303');
  27. # Page is known
  28. test_page(get_page('action=index', 'raw=1',
  29. 'pwd=5de2cbd1cbb2048e4c753c9fa118c130c1c8b91312154bb30bb99961bd620303'),
  30. 'Test');
  31. # Page can be read
  32. test_page(get_page('action=browse', 'id=Test',
  33. 'pwd=5de2cbd1cbb2048e4c753c9fa118c130c1c8b91312154bb30bb99961bd620303'),
  34. 'HelloPrivateWiki');