Add more tests for unbookmark page
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sat, 3 Jun 2017 22:22:08 +0000 (00:22 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Sun, 4 Jun 2017 09:55:29 +0000 (11:55 +0200)
src/test/kotlin/net/pterodactylus/sone/web/pages/UnbookmarkPageTest.kt

index a637b40..1123ec8 100644 (file)
@@ -4,6 +4,8 @@ import net.pterodactylus.sone.data.Post
 import net.pterodactylus.sone.test.mock
 import net.pterodactylus.sone.test.whenever
 import net.pterodactylus.util.web.Method.POST
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
 import org.junit.Test
 import org.mockito.Mockito.any
 import org.mockito.Mockito.never
@@ -12,13 +14,29 @@ import org.mockito.Mockito.verify
 /**
  * Unit test for [UnbookmarkPage].
  */
-class UnbookmarkPageTest : WebPageTest() {
+class UnbookmarkPageTest: WebPageTest() {
 
        private val page = UnbookmarkPage(template, webInterface)
 
        override fun getPage() = page
 
        @Test
+       fun `page returns correct path`() {
+               assertThat(page.path, equalTo("unbookmark.html"))
+       }
+
+       @Test
+       fun `page does not require login`() {
+               assertThat(page.requiresLogin(), equalTo(false))
+       }
+
+       @Test
+       fun `page returns correct title`() {
+               addTranslation("Page.Unbookmark.Title", "unbookmark page title")
+               assertThat(page.getPageTitle(freenetRequest), equalTo("unbookmark page title"))
+       }
+
+       @Test
        fun `get request does not redirect`() {
                verifyNoRedirect { }
        }