Replace web page test base with Kotlin version
[Sone.git] / src / test / kotlin / net / pterodactylus / sone / web / pages / SoneTemplatePageTest.kt
index 2eb77e2..10dfb6e 100644 (file)
@@ -8,7 +8,6 @@ import net.pterodactylus.sone.web.page.FreenetRequest
 import net.pterodactylus.util.notify.Notification
 import net.pterodactylus.util.template.TemplateContext
 import net.pterodactylus.util.version.Version
-import net.pterodactylus.util.web.Method.GET
 import org.hamcrest.Matcher
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.anyOf
@@ -22,10 +21,7 @@ import org.mockito.Mockito.verify
 /**
  * Unit test for [SoneTemplatePage].
  */
-class SoneTemplatePageTest : WebPageTest() {
-
-       private val preferences by lazy { core.preferences!! }
-       private val page = object : SoneTemplatePage("path.html", template, webInterface, true) {}
+class SoneTemplatePageTest: WebPageTest({ template, webInterface -> object : SoneTemplatePage("path.html", template, webInterface, true) {}}) {
 
        @Test
        fun `current sone is retrieved from web interface`() {
@@ -207,14 +203,14 @@ class SoneTemplatePageTest : WebPageTest() {
        @Test
        fun `redirect does happen if sone is not logged in`() {
                unsetCurrentSone()
-               request("index.html", GET)
+               request("index.html")
                assertThat(page.getRedirectTarget(freenetRequest), equalTo("login.html?target=index.html"))
        }
 
        @Test
        fun `redirect does happen with parameters encoded correctly if sone is not logged in`() {
                unsetCurrentSone()
-               request("index.html", GET)
+               request("index.html")
                addHttpRequestParameter("foo", "b=r")
                addHttpRequestParameter("baz", "q&o")
                assertThat(page.getRedirectTarget(freenetRequest), anyOf(