1 package net.pterodactylus.sone.web.pages
3 import net.pterodactylus.sone.web.pages.UnfollowSonePage
4 import net.pterodactylus.util.web.Method.POST
6 import org.mockito.Mockito.verify
9 * Unit test for [UnfollowSonePage].
11 class UnfollowSonePageTest : WebPageTest() {
13 private val page = UnfollowSonePage(template, webInterface)
15 override fun getPage() = page
18 fun `get request does not redirect`() {
19 page.handleRequest(freenetRequest, templateContext)
23 fun `post request unfollows a single sone and redirects to return page`() {
25 addHttpRequestPart("returnPage", "return.html")
26 addHttpRequestPart("sone", "sone-id")
27 verifyRedirect("return.html") {
28 verify(core).unfollowSone(currentSone, "sone-id")
33 fun `post request unfollows two sones and redirects to return page`() {
35 addHttpRequestPart("returnPage", "return.html")
36 addHttpRequestPart("sone", "sone-id1, sone-id2")
37 verifyRedirect("return.html") {
38 verify(core).unfollowSone(currentSone, "sone-id1")
39 verify(core).unfollowSone(currentSone, "sone-id2")