2008-10-11 07:09:42 +00:00
|
|
|
<?php
|
2009-07-15 01:42:18 +00:00
|
|
|
class AdminPageTest extends ShimmieWebTestCase {
|
2008-10-18 06:39:46 +00:00
|
|
|
function testAuth() {
|
2009-07-15 01:42:18 +00:00
|
|
|
$this->get_page('admin');
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_response(403);
|
|
|
|
$this->assert_title("Permission Denied");
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2009-07-15 01:42:18 +00:00
|
|
|
$this->log_in_as_user();
|
|
|
|
$this->get_page('admin');
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_response(403);
|
|
|
|
$this->assert_title("Permission Denied");
|
2009-07-15 01:42:18 +00:00
|
|
|
$this->log_out();
|
2010-03-24 12:32:04 +00:00
|
|
|
}
|
|
|
|
|
2010-05-04 19:10:37 +00:00
|
|
|
function testLowercase() {
|
|
|
|
$ts = time(); // we need a tag that hasn't been used before
|
|
|
|
|
2010-03-24 12:32:04 +00:00
|
|
|
$this->log_in_as_admin();
|
2010-05-04 19:10:37 +00:00
|
|
|
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "TeStCase$ts");
|
2010-03-24 12:32:04 +00:00
|
|
|
|
|
|
|
$this->get_page("post/view/$image_id_1");
|
2010-05-04 19:10:37 +00:00
|
|
|
$this->assert_title("Image $image_id_1: TeStCase$ts");
|
2010-03-24 12:32:04 +00:00
|
|
|
|
|
|
|
$this->get_page('admin');
|
|
|
|
$this->assert_title("Admin Tools");
|
|
|
|
$this->set_field("action", "lowercase all tags");
|
|
|
|
$this->click("Go");
|
|
|
|
|
|
|
|
$this->get_page("post/view/$image_id_1");
|
2010-05-04 19:10:37 +00:00
|
|
|
$this->assert_title("Image $image_id_1: testcase$ts");
|
2010-03-24 12:32:04 +00:00
|
|
|
|
|
|
|
$this->delete_image($image_id_1);
|
|
|
|
$this->log_out();
|
|
|
|
}
|
|
|
|
|
|
|
|
# FIXME: make sure the admin tools actually work
|
|
|
|
function testRecount() {
|
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->get_page('admin');
|
|
|
|
$this->assert_title("Admin Tools");
|
|
|
|
$this->set_field("action", "recount tag use");
|
|
|
|
$this->click("Go");
|
|
|
|
$this->log_out();
|
|
|
|
}
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2010-03-24 12:32:04 +00:00
|
|
|
function testPurge() {
|
2009-07-15 01:42:18 +00:00
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->get_page('admin');
|
2009-08-19 00:28:48 +00:00
|
|
|
$this->assert_title("Admin Tools");
|
2009-10-08 11:47:44 +00:00
|
|
|
$this->set_field("action", "purge unused tags");
|
|
|
|
$this->click("Go");
|
2009-07-15 01:42:18 +00:00
|
|
|
$this->log_out();
|
2010-03-24 12:32:04 +00:00
|
|
|
}
|
2009-07-20 05:51:36 +00:00
|
|
|
|
2010-03-24 12:32:04 +00:00
|
|
|
function testDump() {
|
|
|
|
$this->log_in_as_admin();
|
|
|
|
$this->get_page('admin');
|
|
|
|
$this->assert_title("Admin Tools");
|
|
|
|
$this->set_field("action", "database dump");
|
|
|
|
$this->click("Go");
|
|
|
|
$this->log_out();
|
|
|
|
}
|
2008-10-11 07:09:42 +00:00
|
|
|
}
|
|
|
|
?>
|