X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffreenet%2Fwot%2FWebOfTrustConnectorTest.kt;h=2d02e3a1cd2db971066dfe0ac3f17177850659fc;hp=340d9ca5147f24644b765b0a7ce7b6cf0a814593;hb=3b690f3c533991f2b4088e839114fea675db1d38;hpb=c3e470d2626bcbd932d4b01ce3f6c6b17ce184fd diff --git a/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustConnectorTest.kt b/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustConnectorTest.kt index 340d9ca..2d02e3a 100644 --- a/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustConnectorTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/freenet/wot/WebOfTrustConnectorTest.kt @@ -51,25 +51,25 @@ class WebOfTrustConnectorTest { @Test fun `trusted identities are requested with correct own identity`() { - val pluginConnector = createPluginConnector("GetIdentitiesByScore", hasField("Truster", equalTo("id"))) + createPluginConnector("GetIdentitiesByScore", hasField("Truster", equalTo("id"))) .connect { loadTrustedIdentities(ownIdentity) } } @Test fun `trusted identities are requested with correct selection parameter`() { - val pluginConnector = createPluginConnector("GetIdentitiesByScore", hasField("Selection", equalTo("+"))) + createPluginConnector("GetIdentitiesByScore", hasField("Selection", equalTo("+"))) .connect { loadTrustedIdentities(ownIdentity) } } @Test fun `trusted identities are requested with empty context if null context requested`() { - val pluginConnector = createPluginConnector("GetIdentitiesByScore", hasField("Context", equalTo(""))) + createPluginConnector("GetIdentitiesByScore", hasField("Context", equalTo(""))) .connect { loadTrustedIdentities(ownIdentity) } } @Test fun `trusted identities are requested with context if context requested`() { - val pluginConnector = createPluginConnector("GetIdentitiesByScore", hasField("Context", equalTo("TestContext"))) + createPluginConnector("GetIdentitiesByScore", hasField("Context", equalTo("TestContext"))) .connect { loadTrustedIdentities(ownIdentity, "TestContext") } } @@ -262,6 +262,42 @@ class WebOfTrustConnectorTest { assertThat(trust, isTrust(12, 34, null)) } + @Test + fun `setting trust sends correct own identity id`() { + createPluginConnector("SetTrust", hasField("Truster", equalTo(ownIdentity.id))) + .connect { setTrust(ownIdentity, identity, 123, "Test Trust") } + } + + @Test + fun `setting trust sends correct identity id`() { + createPluginConnector("SetTrust", hasField("Trustee", equalTo(identity.id))) + .connect { setTrust(ownIdentity, identity, 123, "Test Trust") } + } + + @Test + fun `setting trust sends correct trust value`() { + createPluginConnector("SetTrust", hasField("Value", equalTo("123"))) + .connect { setTrust(ownIdentity, identity, 123, "Test Trust") } + } + + @Test + fun `setting trust sends correct comment`() { + createPluginConnector("SetTrust", hasField("Comment", equalTo("Test Trust"))) + .connect { setTrust(ownIdentity, identity, 123, "Test Trust") } + } + + @Test + fun `removing trust sends correct own identity id`() { + createPluginConnector("RemoveTrust", hasField("Truster", equalTo(ownIdentity.id))) + .connect { removeTrust(ownIdentity, identity) } + } + + @Test + fun `removing trust sends correct identity id`() { + createPluginConnector("RemoveTrust", hasField("Trustee", equalTo(identity.id))) + .connect { removeTrust(ownIdentity, identity) } + } + } private fun PluginConnector.connect(block: WebOfTrustConnector.() -> R) =