From: David ‘Bombe’ Roden Date: Sat, 3 Jun 2017 22:22:08 +0000 (+0200) Subject: Add more tests for unbookmark page X-Git-Tag: 0.9.7^2~181 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4d98a47a88176d904960594f1aaaac9e7db15f9a;p=Sone.git Add more tests for unbookmark page --- 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 { } }