Add more tests for mark as known page
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 24 May 2017 04:42:36 +0000 (06:42 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 24 May 2017 04:42:36 +0000 (06:42 +0200)
src/test/kotlin/net/pterodactylus/sone/web/pages/MarkAsKnownPageTest.kt

index dac31ff..a132a70 100644 (file)
@@ -4,21 +4,37 @@ import net.pterodactylus.sone.data.Post
 import net.pterodactylus.sone.data.PostReply
 import net.pterodactylus.sone.data.Sone
 import net.pterodactylus.sone.test.mock
-import net.pterodactylus.sone.web.pages.MarkAsKnownPage
-import net.pterodactylus.sone.web.pages.WebPageTest
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
 import org.junit.Test
 import org.mockito.Mockito.verify
 
 /**
  * Unit test for [MarkAsKnownPage].
  */
-class MarkAsKnownPageTest : WebPageTest() {
+class MarkAsKnownPageTest: WebPageTest() {
 
        private val page = MarkAsKnownPage(template, webInterface)
 
        override fun getPage() = page
 
        @Test
+       fun `page returns correct path`() {
+               assertThat(page.path, equalTo("markAsKnown.html"))
+       }
+
+       @Test
+       fun `page does not require login`() {
+               assertThat(page.requiresLogin(), equalTo(false))
+       }
+
+       @Test
+       fun `page returns correct title`() {
+               addTranslation("Page.MarkAsKnown.Title", "mark as known page title")
+               assertThat(page.getPageTitle(freenetRequest), equalTo("mark as known page title"))
+       }
+
+       @Test
        fun `posts can be marked as known`() {
                addHttpRequestPart("returnPage", "return.html")
                addHttpRequestPart("type", "post")