yet more tests
This commit is contained in:
parent
4abf2ac7dd
commit
27b6f56e01
5 changed files with 118 additions and 0 deletions
34
contrib/ban_words/test.php
Normal file
34
contrib/ban_words/test.php
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
<?php
|
||||||
|
class BanWordsTest extends ShimmieWebTestCase {
|
||||||
|
function testWordBan() {
|
||||||
|
$this->log_in_as_admin();
|
||||||
|
$this->get_page("setup");
|
||||||
|
$this->setField("_config_banned_words", "viagra\nporn\n/http:.*\.cn\//");
|
||||||
|
$this->click("Save Settings");
|
||||||
|
$this->log_out();
|
||||||
|
|
||||||
|
$this->log_in_as_user();
|
||||||
|
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||||
|
|
||||||
|
$this->get_page("post/view/$image_id");
|
||||||
|
$this->setField('comment', "kittens and viagra");
|
||||||
|
$this->click("Post Comment");
|
||||||
|
$this->assertTitle("Comment Blocked");
|
||||||
|
|
||||||
|
$this->get_page("post/view/$image_id");
|
||||||
|
$this->setField('comment', "some link to http://something.cn/");
|
||||||
|
$this->click("Post Comment");
|
||||||
|
$this->assertTitle("Comment Blocked");
|
||||||
|
|
||||||
|
$this->get_page('comment/list');
|
||||||
|
$this->assertTitle('Comments');
|
||||||
|
$this->assertNoText('viagra');
|
||||||
|
$this->assertNoText('http://something.cn/');
|
||||||
|
$this->log_out();
|
||||||
|
|
||||||
|
$this->log_in_as_admin();
|
||||||
|
$this->delete_image($image_id);
|
||||||
|
$this->log_out();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
14
contrib/handle_ico/test.php
Normal file
14
contrib/handle_ico/test.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
class IcoHandlerTest extends ShimmieWebTestCase {
|
||||||
|
function testPixelHander() {
|
||||||
|
$this->log_in_as_user();
|
||||||
|
$image_id = $this->post_image("favicon.ico", "shimmie favicon");
|
||||||
|
$this->assertResponse(302);
|
||||||
|
$this->log_out();
|
||||||
|
|
||||||
|
$this->log_in_as_admin();
|
||||||
|
$this->delete_image($image_id);
|
||||||
|
$this->log_out();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
31
contrib/handle_svg/test.php
Normal file
31
contrib/handle_svg/test.php
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
class SVGHandlerTest extends ShimmieWebTestCase {
|
||||||
|
function testSVGHander() {
|
||||||
|
file_put_contents("test.svg", '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="128"
|
||||||
|
height="128"
|
||||||
|
id="svg2"
|
||||||
|
version="1.0">
|
||||||
|
<g id="layer1">
|
||||||
|
<path
|
||||||
|
style="fill:#0000ff;stroke:#213847;stroke-opacity:1"
|
||||||
|
id="path2383"
|
||||||
|
d="M 120.07832,64.983688 A 55.573441,53.092484 0 1 1 8.9314423,64.983688 A 55.573441,53.092484 0 1 1 120.07832,64.983688 z" />
|
||||||
|
</g>
|
||||||
|
</svg>');
|
||||||
|
|
||||||
|
$this->log_in_as_user();
|
||||||
|
$image_id = $this->post_image("favicon.ico", "shimmie favicon");
|
||||||
|
$this->assertResponse(302);
|
||||||
|
$this->log_out();
|
||||||
|
|
||||||
|
$this->log_in_as_admin();
|
||||||
|
$this->delete_image($image_id);
|
||||||
|
$this->log_out();
|
||||||
|
|
||||||
|
unlink("test.svg");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
25
contrib/news/test.php
Normal file
25
contrib/news/test.php
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
<?php
|
||||||
|
class NewsTest extends ShimmieWebTestCase {
|
||||||
|
function testNews() {
|
||||||
|
$this->log_in_as_admin();
|
||||||
|
|
||||||
|
$this->get_page("setup");
|
||||||
|
$this->setField("_config_news_text", "kittens");
|
||||||
|
$this->click("Save Settings");
|
||||||
|
|
||||||
|
$this->get_page("post/list");
|
||||||
|
$this->assertText("Note");
|
||||||
|
$this->assertText("kittens");
|
||||||
|
|
||||||
|
$this->get_page("setup");
|
||||||
|
$this->setField("_config_news_text", "");
|
||||||
|
$this->click("Save Settings");
|
||||||
|
|
||||||
|
$this->get_page("post/list");
|
||||||
|
$this->assertNoText("Note");
|
||||||
|
$this->assertNoText("kittens");
|
||||||
|
|
||||||
|
$this->log_out();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
14
ext/handle_pixel/test.php
Normal file
14
ext/handle_pixel/test.php
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<?php
|
||||||
|
class PixelHandlerTest extends ShimmieWebTestCase {
|
||||||
|
function testPixelHander() {
|
||||||
|
$this->log_in_as_user();
|
||||||
|
$image_id = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "pbx computer screenshot");
|
||||||
|
$this->assertResponse(302);
|
||||||
|
$this->log_out();
|
||||||
|
|
||||||
|
$this->log_in_as_admin();
|
||||||
|
$this->delete_image($image_id);
|
||||||
|
$this->log_out();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Reference in a new issue