2008-10-11 07:09:42 +00:00
|
|
|
<?php
|
2015-08-09 12:14:28 +01:00
|
|
|
class IPBanTest {
|
2008-10-11 07:09:42 +00:00
|
|
|
function testIPBan() {
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page('ip_ban/list');
|
2009-08-19 01:28:48 +01:00
|
|
|
$this->assert_response(403);
|
|
|
|
$this->assert_title("Permission Denied");
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->log_in_as_admin();
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page('ip_ban/list');
|
2009-08-19 01:28:48 +01:00
|
|
|
$this->assert_no_text("42.42.42.42");
|
|
|
|
$this->set_field('ip', '42.42.42.42');
|
|
|
|
$this->set_field('reason', 'unit testing');
|
|
|
|
$this->set_field('end', '1 week');
|
2008-10-11 07:09:42 +00:00
|
|
|
$this->click("Ban");
|
2009-01-04 11:18:37 -08:00
|
|
|
|
2009-08-19 01:28:48 +01:00
|
|
|
$this->assert_text("42.42.42.42");
|
2008-10-11 07:09:42 +00:00
|
|
|
$this->click("Remove"); // FIXME: remove which ban? :S
|
2009-08-19 01:28:48 +01:00
|
|
|
$this->assert_no_text("42.42.42.42");
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2012-03-09 22:08:55 +00:00
|
|
|
$this->get_page('ip_ban/list?all=on'); // just test it doesn't crash for now
|
2009-09-27 15:48:38 +01:00
|
|
|
|
2009-07-15 02:42:18 +01:00
|
|
|
$this->log_out();
|
2009-07-20 06:51:36 +01:00
|
|
|
|
|
|
|
# FIXME: test that the IP is actually banned
|
2008-10-11 07:09:42 +00:00
|
|
|
}
|
|
|
|
}
|
2014-04-25 22:54:51 -04:00
|
|
|
|
2008-10-11 07:09:42 +00:00
|
|
|
|