X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FSoneTemplatePageTest.kt;h=4cef5b0676d34367f65d22a5fa1bf8da5b34f7f9;hp=42d66766d57f546801b02fd18cd261cdfed5da6d;hb=6b29b49714912ff5e3e410d2484699cdf8041b90;hpb=de7568a82eb4150bf6d2b0553841b7b69f84c968 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt index 42d6676..4cef5b0 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/SoneTemplatePageTest.kt @@ -4,12 +4,10 @@ import net.pterodactylus.sone.data.Sone import net.pterodactylus.sone.main.SonePlugin import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.whenever -import net.pterodactylus.sone.web.pages.SoneTemplatePage 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 @@ -36,8 +34,8 @@ class SoneTemplatePageTest : WebPageTest() { @Test fun `retrieving current sone without creation is forwarded to web interface`() { mock().let { - whenever(webInterface.getCurrentSoneWithoutCreatingSession(toadletContext)).thenReturn(it) - assertThat(page.getCurrentSoneWithoutCreatingSession(toadletContext), equalTo(it)) + whenever(webInterface.getCurrentSone(toadletContext, false)).thenReturn(it) + assertThat(page.getCurrentSone(toadletContext, false), equalTo(it)) } } @@ -208,14 +206,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(