projects
/
Sone.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Remove obsolete loading animation
[Sone.git]
/
src
/
test
/
kotlin
/
net
/
pterodactylus
/
sone
/
web
/
OptionsPageTest.kt
diff --git
a/src/test/kotlin/net/pterodactylus/sone/web/OptionsPageTest.kt
b/src/test/kotlin/net/pterodactylus/sone/web/OptionsPageTest.kt
index
c79b497
..
cb8a3e5
100644
(file)
--- a/
src/test/kotlin/net/pterodactylus/sone/web/OptionsPageTest.kt
+++ b/
src/test/kotlin/net/pterodactylus/sone/web/OptionsPageTest.kt
@@
-6,7
+6,6
@@
import net.pterodactylus.sone.data.SoneOptions.LoadExternalContent.TRUSTED
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING
import net.pterodactylus.sone.test.whenever
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired
import net.pterodactylus.sone.fcp.FcpInterface.FullAccessRequired.WRITING
import net.pterodactylus.sone.test.whenever
-import net.pterodactylus.sone.web.WebTestUtils.redirectsTo
import net.pterodactylus.util.web.Method.GET
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
import net.pterodactylus.util.web.Method.GET
import net.pterodactylus.util.web.Method.POST
import org.hamcrest.MatcherAssert.assertThat
@@
-23,6
+22,8
@@
class OptionsPageTest : WebPageTest() {
private val page = OptionsPage(template, webInterface)
private val page = OptionsPage(template, webInterface)
+ override fun getPage() = page
+
@Before
fun setupPreferences() {
core.preferences.insertionDelay = 1
@Before
fun setupPreferences() {
core.preferences.insertionDelay = 1
@@
-91,13
+92,10
@@
class OptionsPageTest : WebPageTest() {
private fun <T> verifyThatOptionCanBeSet(option: String, setValue: Any?, expectedValue: T, getter: () -> T) {
request("", POST)
private fun <T> verifyThatOptionCanBeSet(option: String, setValue: Any?, expectedValue: T, getter: () -> T) {
request("", POST)
+ addHttpRequestParameter(option, setValue.toString())
addHttpRequestParameter("show-custom-avatars", "ALWAYS")
addHttpRequestParameter("load-linked-images", "ALWAYS")
addHttpRequestParameter("show-custom-avatars", "ALWAYS")
addHttpRequestParameter("load-linked-images", "ALWAYS")
- addHttpRequestParameter(option, setValue.toString())
- expectedException.expect(redirectsTo("options.html"))
- try {
- page.handleRequest(freenetRequest, templateContext)
- } finally {
+ verifyRedirect("options.html") {
assertThat(getter(), equalTo(expectedValue))
}
}
assertThat(getter(), equalTo(expectedValue))
}
}
@@
-149,10
+147,7
@@
class OptionsPageTest : WebPageTest() {
unsetCurrentSone()
request("", POST)
addHttpRequestParameter(name, setValue)
unsetCurrentSone()
request("", POST)
addHttpRequestParameter(name, setValue)
- expectedException.expect(redirectsTo("options.html"))
- try {
- page.handleRequest(freenetRequest, templateContext)
- } finally {
+ verifyRedirect("options.html") {
assertThat(getter(), equalTo(expectedValue))
}
}
assertThat(getter(), equalTo(expectedValue))
}
}