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

index f58ea97..25678ca 100644 (file)
@@ -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") {