2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2019-05-28 17:59:38 +01:00
|
|
|
class IPBanTest extends ShimmiePHPUnitTestCase
|
|
|
|
{
|
|
|
|
public function testIPBan()
|
|
|
|
{
|
|
|
|
$this->get_page('ip_ban/list');
|
|
|
|
$this->assert_response(403);
|
|
|
|
$this->assert_title("Permission Denied");
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
$this->log_in_as_admin();
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
$this->get_page('ip_ban/list');
|
|
|
|
$this->assert_no_text("42.42.42.42");
|
2015-09-24 23:16:38 +01:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
$this->markTestIncomplete();
|
2015-09-24 23:16:38 +01:00
|
|
|
|
2019-11-24 13:25:41 +00:00
|
|
|
$this->set_field('c_ip', '42.42.42.42');
|
|
|
|
$this->set_field('c_reason', 'unit testing');
|
|
|
|
$this->set_field('c_expires', '1 week');
|
2019-05-28 17:59:38 +01:00
|
|
|
$this->click("Ban");
|
2009-01-04 11:18:37 -08:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
$this->assert_text("42.42.42.42");
|
|
|
|
$this->click("Remove"); // FIXME: remove which ban? :S
|
|
|
|
$this->assert_no_text("42.42.42.42");
|
2008-10-11 07:09:42 +00:00
|
|
|
|
2019-11-24 13:25:41 +00:00
|
|
|
$this->get_page('ip_ban/list?r_all=on'); // just test it doesn't crash for now
|
2009-09-27 15:48:38 +01:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
# FIXME: test that the IP is actually banned
|
|
|
|
}
|
2008-10-11 07:09:42 +00:00
|
|
|
}
|