From 04a7ae5658a170f12eb9118acfb2df1305e571ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Wed, 24 May 2017 06:42:36 +0200 Subject: [PATCH] Add more tests for mark as known page --- .../sone/web/pages/MarkAsKnownPageTest.kt | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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") -- 2.7.4