From 75d4c6cf7399dacb8b430b2a296a3fb6efede5be Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 16 Jul 2009 20:21:49 +0100 Subject: [PATCH] yet more tests --- contrib/ban_words/test.php | 34 ++++++++++++++++++++++++++++++++++ contrib/handle_ico/test.php | 14 ++++++++++++++ contrib/handle_svg/test.php | 31 +++++++++++++++++++++++++++++++ contrib/news/test.php | 25 +++++++++++++++++++++++++ ext/handle_pixel/test.php | 14 ++++++++++++++ 5 files changed, 118 insertions(+) create mode 100644 contrib/ban_words/test.php create mode 100644 contrib/handle_ico/test.php create mode 100644 contrib/handle_svg/test.php create mode 100644 contrib/news/test.php create mode 100644 ext/handle_pixel/test.php diff --git a/contrib/ban_words/test.php b/contrib/ban_words/test.php new file mode 100644 index 00000000..a457c157 --- /dev/null +++ b/contrib/ban_words/test.php @@ -0,0 +1,34 @@ +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(); + } +} +?> diff --git a/contrib/handle_ico/test.php b/contrib/handle_ico/test.php new file mode 100644 index 00000000..b1fe8b83 --- /dev/null +++ b/contrib/handle_ico/test.php @@ -0,0 +1,14 @@ +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(); + } +} +?> diff --git a/contrib/handle_svg/test.php b/contrib/handle_svg/test.php new file mode 100644 index 00000000..fe0751ad --- /dev/null +++ b/contrib/handle_svg/test.php @@ -0,0 +1,31 @@ + + + + + +'); + + $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"); + } +} +?> diff --git a/contrib/news/test.php b/contrib/news/test.php new file mode 100644 index 00000000..0e959439 --- /dev/null +++ b/contrib/news/test.php @@ -0,0 +1,25 @@ +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(); + } +} +?> diff --git a/ext/handle_pixel/test.php b/ext/handle_pixel/test.php new file mode 100644 index 00000000..f5d76e3a --- /dev/null +++ b/ext/handle_pixel/test.php @@ -0,0 +1,14 @@ +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(); + } +} +?>