X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fpages%2FWebPageTest2.kt;h=bf328a7691cd3990a3ad66cbd64990c0a612ae9d;hp=08d00f94c0152b1d40245dec5e7a0f26819ebfe7;hb=6a03d8624a9b1872f6e3eeb259f5d49b4a5686a3;hpb=794a73f956fce98dfc04c675bc4b903e42a2ffde diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt index 08d00f9..bf328a7 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/WebPageTest2.kt @@ -9,6 +9,7 @@ import net.pterodactylus.sone.data.Image import net.pterodactylus.sone.data.Post import net.pterodactylus.sone.data.PostReply import net.pterodactylus.sone.data.Sone +import net.pterodactylus.sone.freenet.wot.OwnIdentity import net.pterodactylus.sone.test.deepMock import net.pterodactylus.sone.test.get import net.pterodactylus.sone.test.mock @@ -55,6 +56,7 @@ abstract class WebPageTest2(pageSupplier: (Template, WebInterface) -> SoneTempla private val requestHeaders = mutableMapOf() private val getRequestParameters = mutableMapOf>() private val postRequestParameters = mutableMapOf() + private val ownIdentities = mutableSetOf() private val allSones = mutableMapOf() private val localSones = mutableMapOf() private val allPosts = mutableMapOf() @@ -67,6 +69,7 @@ abstract class WebPageTest2(pageSupplier: (Template, WebInterface) -> SoneTempla @Before fun setupCore() { whenever(core.preferences).thenReturn(preferences) + whenever(core.identityManager.allOwnIdentities).then { ownIdentities } whenever(core.sones).then { allSones.values } whenever(core.getSone(anyString())).then { allSones[it[0]].asOptional() } whenever(core.localSones).then { localSones.values } @@ -147,6 +150,10 @@ abstract class WebPageTest2(pageSupplier: (Template, WebInterface) -> SoneTempla whenever(webInterface.getCurrentSoneWithoutCreatingSession(eq(toadletContext))).thenReturn(null) } + fun addOwnIdentity(ownIdentity: OwnIdentity) { + ownIdentities += ownIdentity + } + fun addSone(id: String, sone: Sone) { allSones[id] = sone }