From 28b8d916e878535f5f93c7c2600a6d2e04e5ffcd Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Sun, 9 Apr 2017 10:58:13 +0200 Subject: [PATCH] Add more tests for follow Sone page --- .../sone/web/pages/FollowSonePageTest.kt | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt index f595b4a..df65727 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/FollowSonePageTest.kt @@ -2,10 +2,11 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.web.pages.FollowSonePage -import net.pterodactylus.sone.web.pages.WebPageTest +import net.pterodactylus.sone.test.whenever import net.pterodactylus.util.web.Method.GET import net.pterodactylus.util.web.Method.POST +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo import org.junit.Test import org.mockito.ArgumentMatchers import org.mockito.ArgumentMatchers.any @@ -23,6 +24,22 @@ class FollowSonePageTest : WebPageTest() { override fun getPage() = page @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("followSone.html")) + } + + @Test + fun `page requires login`() { + assertThat(page.requiresLogin(), equalTo(true)) + } + + @Test + fun `page returns correct title`() { + whenever(l10n.getString("Page.FollowSone.Title")).thenReturn("follow sone page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("follow sone page title")) + } + + @Test fun `get request does not redirect`() { request("", GET) page.handleRequest(freenetRequest, templateContext) -- 2.7.4