From: David ‘Bombe’ Roden Date: Wed, 24 May 2017 04:42:36 +0000 (+0200) Subject: Add more tests for mark as known page X-Git-Tag: 0.9.7^2~208 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=04a7ae5658a170f12eb9118acfb2df1305e571ac;p=Sone.git Add more tests for mark as known page --- diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt index dac31ff..a132a70 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt @@ -4,21 +4,37 @@ import net.pterodactylus.sone.data.Post import net.pterodactylus.sone.data.PostReply import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.web.pages.MarkAsKnownPage -import net.pterodactylus.sone.web.pages.WebPageTest +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo import org.junit.Test import org.mockito.Mockito.verify /** * Unit test for [MarkAsKnownPage]. */ -class MarkAsKnownPageTest : WebPageTest() { +class MarkAsKnownPageTest: WebPageTest() { private val page = MarkAsKnownPage(template, webInterface) override fun getPage() = page @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("markAsKnown.html")) + } + + @Test + fun `page does not require login`() { + assertThat(page.requiresLogin(), equalTo(false)) + } + + @Test + fun `page returns correct title`() { + addTranslation("Page.MarkAsKnown.Title", "mark as known page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("mark as known page title")) + } + + @Test fun `posts can be marked as known`() { addHttpRequestPart("returnPage", "return.html") addHttpRequestPart("type", "post")