From: David ‘Bombe’ Roden Date: Tue, 23 May 2017 18:18:09 +0000 (+0200) Subject: Add more tests for lock Sone page X-Git-Tag: 0.9.7^2~212 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=4e8ae410b3b366432367d86863685406334cc4be;p=Sone.git Add more tests for lock Sone page --- 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") {