X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Ffcp%2FFcpInterfaceTest.kt;h=6e1a06c0a2ec7bc6be95faf73d7982b701847790;hb=b91623458a0059ec31e6f57768b5814df97c093a;hp=e9137b06258adde6f5f9790f96249d62afbab605;hpb=0a481aacb47d7c1e90c1c212a58f87af29e3ebb6;p=Sone.git diff --git a/src/test/kotlin/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt b/src/test/kotlin/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt index e9137b0..6e1a06c 100644 --- a/src/test/kotlin/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/fcp/FcpInterfaceTest.kt @@ -20,8 +20,8 @@ import net.pterodactylus.sone.freenet.fcp.Command.AccessType import net.pterodactylus.sone.freenet.fcp.Command.AccessType.FULL_FCP import net.pterodactylus.sone.freenet.fcp.Command.AccessType.RESTRICTED_FCP import net.pterodactylus.sone.freenet.fcp.Command.Response -import net.pterodactylus.sone.test.bindAs import net.pterodactylus.sone.test.capture +import net.pterodactylus.sone.test.isProvidedBy import net.pterodactylus.sone.test.mock import net.pterodactylus.sone.test.whenever import org.hamcrest.MatcherAssert.assertThat @@ -64,7 +64,7 @@ class FcpInterfaceTest { @Test fun `fcp interface is instantiated as singleton`() { - val injector = Guice.createInjector(core.bindAs(Core::class)) + val injector = Guice.createInjector(Core::class.isProvidedBy(core)) assertThat(injector.getInstance(FcpInterface::class.java), sameInstance(injector.getInstance(FcpInterface::class.java))) } @@ -101,8 +101,9 @@ class FcpInterfaceTest { } @Test - fun `sending command to inactive fcp interface results in 400 error reply`() { + fun `sending command to inactive fcp interface results in 503 error reply`() { fcpInterface.fcpInterfaceDeactivated(FcpInterfaceDeactivatedEvent()) + parameters.putSingle("Identifier", "Test") fcpInterface.handle(pluginReplySender, parameters, null, 0) verify(pluginReplySender).send(replyParameters.capture()) assertThat(replyParameters.value["Message"], equalTo("Error")) @@ -119,6 +120,7 @@ class FcpInterfaceTest { @Test fun `sending command over non-authorized connection results in 401 error reply`() { fcpInterface.fcpInterfaceActivated(FcpInterfaceActivatedEvent()) + parameters.putSingle("Identifier", "Test") parameters.putSingle("Message", "Working") fcpInterface.handle(pluginReplySender, parameters, null, RESTRICTED_FCP.ordinal) verify(pluginReplySender).send(replyParameters.capture()) @@ -129,6 +131,7 @@ class FcpInterfaceTest { @Test fun `sending unknown command results in 404 error reply`() { fcpInterface.fcpInterfaceActivated(FcpInterfaceActivatedEvent()) + parameters.putSingle("Identifier", "Test") fcpInterface.handle(pluginReplySender, parameters, null, RESTRICTED_FCP.ordinal) verify(pluginReplySender).send(replyParameters.capture()) assertThat(replyParameters.value["Message"], equalTo("Error"))