From 4d98a47a88176d904960594f1aaaac9e7db15f9a Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 4 Jun 2017 00:22:08 +0200 Subject: [PATCH] Add more tests for unbookmark page --- .../sone/web/pages/UnbookmarkPageTest.kt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt index a637b40..1123ec8 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt @@ -4,6 +4,8 @@ import net.pterodactylus.sone.data.Post import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.whenever import net.pterodactylus.util.web.Method.POST +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo import org.junit.Test import org.mockito.Mockito.any import org.mockito.Mockito.never @@ -12,13 +14,29 @@ import org.mockito.Mockito.verify /** * Unit test for [UnbookmarkPage]. */ -class UnbookmarkPageTest : WebPageTest() { +class UnbookmarkPageTest: WebPageTest() { private val page = UnbookmarkPage(template, webInterface) override fun getPage() = page @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("unbookmark.html")) + } + + @Test + fun `page does not require login`() { + assertThat(page.requiresLogin(), equalTo(false)) + } + + @Test + fun `page returns correct title`() { + addTranslation("Page.Unbookmark.Title", "unbookmark page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("unbookmark page title")) + } + + @Test fun `get request does not redirect`() { verifyNoRedirect { } } -- 2.7.4