Add some tests
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 24 Mar 2017 19:23:55 +0000 (20:23 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 24 Mar 2017 19:23:55 +0000 (20:23 +0100)
src/test/kotlin/net/pterodactylus/sone/web/EditAlbumPageTest.kt

index 9e3065b..bf3b97f 100644 (file)
@@ -8,6 +8,8 @@ import net.pterodactylus.sone.test.mockBuilder
 import net.pterodactylus.sone.test.whenever
 import net.pterodactylus.util.web.Method.GET
 import net.pterodactylus.util.web.Method.POST
+import org.hamcrest.MatcherAssert.assertThat
+import org.hamcrest.Matchers.equalTo
 import org.junit.Before
 import org.junit.Test
 import org.mockito.Mockito.verify
@@ -15,7 +17,7 @@ import org.mockito.Mockito.verify
 /**
  * Unit test for [EditAlbumPage].
  */
-class EditAlbumPageTest : WebPageTest() {
+class EditAlbumPageTest: WebPageTest() {
 
        private val page = EditAlbumPage(template, webInterface)
 
@@ -39,6 +41,22 @@ class EditAlbumPageTest : WebPageTest() {
        }
 
        @Test
+       fun `page returns correct path`() {
+               assertThat(page.path, equalTo("editAlbum.html"))
+       }
+
+       @Test
+       fun `page requires login`() {
+               assertThat(page.requiresLogin(), equalTo(true))
+       }
+
+       @Test
+       fun `page returns correct title`() {
+               whenever(l10n.getString("Page.EditAlbum.Title")).thenReturn("edit album page")
+               assertThat(page.getPageTitle(freenetRequest), equalTo("edit album page"))
+       }
+
+       @Test
        fun `get request does not redirect`() {
                request("", GET)
                page.handleRequest(freenetRequest, templateContext)