From: David ‘Bombe’ Roden Date: Tue, 23 May 2017 18:55:34 +0000 (+0200) Subject: Add more tests for logout page X-Git-Tag: 0.9.7^2~210 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=f07447eb66a4ec3a8045248252b0286391d82893;p=Sone.git Add more tests for logout page --- diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt index 14ba030..3718a49 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt @@ -1,8 +1,6 @@ package net.pterodactylus.sone.web.pages import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.web.pages.LogoutPage -import net.pterodactylus.sone.web.pages.WebPageTest import org.hamcrest.MatcherAssert.assertThat import org.hamcrest.Matchers.equalTo import org.junit.Test @@ -11,13 +9,29 @@ import org.mockito.Mockito.verify /** * Unit test for [LogoutPage]. */ -class LogoutPageTest : WebPageTest() { +class LogoutPageTest: WebPageTest() { private val page = LogoutPage(template, webInterface) override fun getPage() = page @Test + fun `page returns correct path`() { + assertThat(page.path, equalTo("logout.html")) + } + + @Test + fun `page requires login`() { + assertThat(page.requiresLogin(), equalTo(true)) + } + + @Test + fun `page returns correct title`() { + addTranslation("Page.Logout.Title", "logout page title") + assertThat(page.getPageTitle(freenetRequest), equalTo("logout page title")) + } + + @Test fun `page unsets current sone and redirects to index`() { verifyRedirect("index.html") { verify(webInterface).setCurrentSone(toadletContext, null)