From: Zero Date: Fri, 10 Dec 2021 07:03:17 +0000 (+0800) Subject: Add unit test for ip addess searching X-Git-Tag: v21.12~1^2~8^2 X-Git-Url: http://source.bookstackapp.com/bookstack/commitdiff_plain/refs/pull/3081/head Add unit test for ip addess searching --- diff --git a/tests/AuditLogTest.php b/tests/AuditLogTest.php index f909cd79a..26eb2b9f9 100644 --- a/tests/AuditLogTest.php +++ b/tests/AuditLogTest.php @@ -166,6 +166,24 @@ class AuditLogTest extends TestCase $resp->assertSee('192.123.45.1'); } + public function test_ip_address_is_searchable() + { + config()->set('app.proxies', '*'); + $editor = $this->getEditor(); + /** @var Page $page */ + $page = Page::query()->first(); + + $this->actingAs($editor)->put($page->getUrl(), [ + 'name' => 'Updated page', + 'html' => '

Updated content

', + ], [ + 'X-Forwarded-For' => '192.123.45.1', + ])->assertRedirect($page->refresh()->getUrl()); + + $resp = $this->asAdmin()->get('/settings/audit?&ip=192.123'); + $resp->assertSee('192.123.45.1'); + } + public function test_ip_address_not_logged_in_demo_mode() { config()->set('app.proxies', '*');