import net.pterodactylus.sone.web.page.FreenetRequest
import net.pterodactylus.util.template.Template
import net.pterodactylus.util.template.TemplateContext
+import javax.inject.Inject
/**
* This page lets the user edit the options of the Sone plugin.
*/
-class OptionsPage(template: Template, webInterface: WebInterface):
+class OptionsPage @Inject constructor(template: Template, webInterface: WebInterface):
SoneTemplatePage("options.html", webInterface, template, "Page.Options.Title") {
override fun handleRequest(freenetRequest: FreenetRequest, templateContext: TemplateContext) {
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.ALWAYS
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.NO
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING
+import net.pterodactylus.sone.test.getInstance
import net.pterodactylus.sone.test.whenever
+import net.pterodactylus.sone.web.baseInjector
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import org.hamcrest.Matchers.equalTo
import org.hamcrest.Matchers.hasItem
+import org.hamcrest.Matchers.notNullValue
import org.hamcrest.Matchers.nullValue
import org.junit.Before
import org.junit.Test
verifyThatPreferencesCanBeSet("trust-comment", "", "Set from Sone Web Interface") { core.preferences.trustComment }
}
+ @Test
+ fun `page can be created by dependency injection`() {
+ assertThat(baseInjector.getInstance<OptionsPage>(), notNullValue())
+ }
+
}