Add more tests for logout page
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 23 May 2017 18:55:34 +0000 (20:55 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 23 May 2017 18:55:34 +0000 (20:55 +0200)
src/test/kotlin/net/pterodactylus/sone/web/pages/LogoutPageTest.kt

index 14ba030..3718a49 100644 (file)
@@ -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)