From 4e8ae410b3b366432367d86863685406334cc4be Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 23 May 2017 20:18:09 +0200 Subject: [PATCH] Add more tests for lock Sone page --- .../pterodactylus/sone/web/pages/LockSonePageTest.kt | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt index f58ea97..25678ca 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LockSonePageTest.kt @@ -2,8 +2,8 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.test.mock -import net.pterodactylus.sone.web.pages.LockSonePage -import net.pterodactylus.sone.web.pages.WebPageTest +import org.hamcrest.MatcherAssert.assertThat +import org.hamcrest.Matchers.equalTo import org.junit.Test import org.mockito.ArgumentMatchers.any import org.mockito.Mockito.never @@ -19,6 +19,22 @@ class LockSonePageTest : WebPageTest() { override fun getPage() = page @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("lockSone.html")) + } + + @Test + fun `page requires login`() { + assertThat(page.requiresLogin(), equalTo(false)) + } + + @Test + fun `page returns correct title`() { + addTranslation("Page.LockSone.Title", "lock Sone page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("lock Sone page title")) + } + + @Test fun `locking an invalid local sone redirects to return page`() { addHttpRequestPart("returnPage", "return.html") verifyRedirect("return.html") { -- 2.7.4