This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/admin/test.php

84 lines
2.2 KiB
PHP
Raw Normal View History

<?php
class AdminPageTest extends ShimmieWebTestCase {
function testAuth() {
$this->get_page('admin');
2009-08-19 00:28:48 +00:00
$this->assert_response(403);
$this->assert_title("Permission Denied");
$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");
$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
2012-03-09 22:08:55 +00:00
$this->get_page("post/view/$image_id_1");
$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");
2012-03-11 00:17:09 +00:00
$this->click("All tags to lowercase");
2010-03-24 12:32:04 +00:00
2012-03-09 22:08:55 +00:00
$this->get_page("post/view/$image_id_1");
2012-03-11 00:17:09 +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");
2012-03-11 00:17:09 +00:00
$this->click("Recount tag use");
2010-03-24 12:32:04 +00:00
$this->log_out();
}
2010-03-24 12:32:04 +00:00
function testPurge() {
$this->log_in_as_admin();
$this->get_page('admin');
2009-08-19 00:28:48 +00:00
$this->assert_title("Admin Tools");
2012-03-11 00:17:09 +00:00
$this->click("Purge unused tags");
$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");
2012-03-11 00:17:09 +00:00
$this->click("Download database contents");
2012-03-11 14:02:00 +00:00
$this->assert_response(200);
$this->log_out();
}
function testDBQ() {
$this->log_in_as_user();
$image_id_1 = $this->post_image("ext/simpletest/data/pbx_screenshot.jpg", "test");
$image_id_2 = $this->post_image("ext/simpletest/data/bedroom_workshop.jpg", "test2");
$image_id_3 = $this->post_image("ext/simpletest/data/favicon.png", "test");
$this->get_page("post/list/test/1");
$this->click("Delete All These Images");
$this->get_page("post/view/$image_id_1");
$this->assert_response(404);
$this->get_page("post/view/$image_id_2");
$this->assert_response(200);
$this->get_page("post/view/$image_id_3");
$this->assert_response(404);
2012-04-01 17:17:33 +00:00
$this->delete_image($image_id_1);
2012-03-11 14:02:00 +00:00
$this->delete_image($image_id_2);
2012-04-01 17:17:33 +00:00
$this->delete_image($image_id_3);
2010-03-24 12:32:04 +00:00
$this->log_out();
}
}