enclosure.t 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Copyright (C) 2007 Alex Schroeder <alex@gnu.org>
  2. #
  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.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  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/>.
  15. require './t/test.pl';
  16. package OddMuse;
  17. use Test::More tests => 11;
  18. add_module('enclosure.pl');
  19. add_module('creole.pl');
  20. AppendStringToFile($ConfigFile, "\$UploadAllowed = 1;\n");
  21. test_page(update_page('MyImage', "#FILE image/png\niVBORw0KGgoAAAA"),
  22. 'This page contains an uploaded file');
  23. test_page(update_page('MyOtherImage', "#FILE image/png\niVBORw0KGgoAAAA"),
  24. 'This page contains an uploaded file');
  25. xpath_run_tests('[[enclosure:MyImage]]'
  26. => '//a[@class="upload"][@href="http://localhost/test.pl/download/MyImage"][text()="MyImage"]',
  27. '[[enclosure:MyImage|image]]'
  28. => '//a[@class="upload"][@href="http://localhost/test.pl/download/MyImage"][text()="image"]');
  29. test_page(update_page('2007-08-05', 'Show notes linking to [[enclosure:MyImage]]
  30. and [[enclosure:MyImage]] (no duplicates!)
  31. and {{{[[enclosure:MyExampleImage]]}}} (no links to quoted enclosures)
  32. and [[enclosure:MyMissingImage|image]] (do not link missing)
  33. and [[enclosure:MyOtherImage|image]] (different name).', 'First Post!'),
  34. 'Show notes');
  35. test_page(get_page('action=rss match=^2007 title=Podcast'),
  36. '<title>Wiki: Podcast</title>',
  37. '<title>2007-08-05</title>',
  38. '<link>http://localhost/wiki.pl/2007-08-05</link>',
  39. '<description>First Post!</description>',
  40. '<enclosure url="http://localhost/wiki.pl/download/MyImage" length="11" type="image/png" />',
  41. '<enclosure url="http://localhost/wiki.pl/download/MyOtherImage" length="11" type="image/png" />');